Class: OAI::Provider::Response::Base
- Inherits:
-
Object
- Object
- OAI::Provider::Response::Base
- Defined in:
- lib/oai/provider/response.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.default_options ⇒ Object
readonly
Returns the value of attribute default_options.
-
.required_options ⇒ Object
readonly
Returns the value of attribute required_options.
-
.valid_options ⇒ Object
readonly
Returns the value of attribute valid_options.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#provider ⇒ Object
readonly
Returns the value of attribute provider.
Class Method Summary collapse
- .default_parameters(options = {}) ⇒ Object
- .required_parameters(*args) ⇒ Object
- .valid_parameters(*args) ⇒ Object
Instance Method Summary collapse
-
#initialize(provider, options = {}) ⇒ Base
constructor
A new instance of Base.
- #response ⇒ Object
Constructor Details
#initialize(provider, options = {}) ⇒ Base
Returns a new instance of Base.
31 32 33 34 35 |
# File 'lib/oai/provider/response.rb', line 31 def initialize(provider, = {}) @provider = provider @options = internalize() raise OAI::ArgumentException.new unless valid? end |
Class Attribute Details
.default_options ⇒ Object (readonly)
Returns the value of attribute default_options.
11 12 13 |
# File 'lib/oai/provider/response.rb', line 11 def @default_options end |
.required_options ⇒ Object (readonly)
Returns the value of attribute required_options.
11 12 13 |
# File 'lib/oai/provider/response.rb', line 11 def @required_options end |
.valid_options ⇒ Object (readonly)
Returns the value of attribute valid_options.
11 12 13 |
# File 'lib/oai/provider/response.rb', line 11 def @valid_options end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/oai/provider/response.rb', line 8 def @options end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
8 9 10 |
# File 'lib/oai/provider/response.rb', line 8 def provider @provider end |
Class Method Details
.default_parameters(options = {}) ⇒ Object
18 19 20 21 |
# File 'lib/oai/provider/response.rb', line 18 def default_parameters( = {}) @default_options ||= {} @default_options.merge! .dup end |
.required_parameters(*args) ⇒ Object
23 24 25 26 27 |
# File 'lib/oai/provider/response.rb', line 23 def required_parameters(*args) valid_parameters(*args) @required_options ||= [] @required_options = (@required_options + args.dup).uniq end |
.valid_parameters(*args) ⇒ Object
13 14 15 16 |
# File 'lib/oai/provider/response.rb', line 13 def valid_parameters(*args) @valid_options ||= [] @valid_options = (@valid_options + args.dup).uniq end |
Instance Method Details
#response ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/oai/provider/response.rb', line 37 def response @builder = Builder::XmlMarkup.new @builder.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8" @builder.tag!('OAI-PMH', header) do @builder.responseDate Time.now.utc.xmlschema @builder.request(provider.url, ) yield @builder end end |