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.
28 29 30 31 32 33 |
# File 'lib/oai/provider/response.rb', line 28 def initialize(provider, = {}) @provider = provider @original_options = .dup @options = internalize() raise OAI::ArgumentException.new unless valid? end |
Class Attribute Details
.default_options ⇒ Object (readonly)
Returns the value of attribute default_options.
10 11 12 |
# File 'lib/oai/provider/response.rb', line 10 def @default_options end |
.required_options ⇒ Object (readonly)
Returns the value of attribute required_options.
10 11 12 |
# File 'lib/oai/provider/response.rb', line 10 def @required_options end |
.valid_options ⇒ Object (readonly)
Returns the value of attribute valid_options.
10 11 12 |
# File 'lib/oai/provider/response.rb', line 10 def @valid_options end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/oai/provider/response.rb', line 7 def @options end |
#provider ⇒ Object (readonly)
Returns the value of attribute provider.
7 8 9 |
# File 'lib/oai/provider/response.rb', line 7 def provider @provider end |
Class Method Details
.default_parameters(options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/oai/provider/response.rb', line 16 def default_parameters( = {}) @default_options ||= {} @default_options.merge! .dup end |
.required_parameters(*args) ⇒ Object
21 22 23 24 25 |
# File 'lib/oai/provider/response.rb', line 21 def required_parameters(*args) valid_parameters(*args) @required_options ||= [] @required_options = (@required_options + args.dup).uniq end |
.valid_parameters(*args) ⇒ Object
11 12 13 14 |
# File 'lib/oai/provider/response.rb', line 11 def valid_parameters(*args) @valid_options ||= [] @valid_options = (@valid_options + args.dup).uniq end |
Instance Method Details
#response ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/oai/provider/response.rb', line 35 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 #options parameter has been removed here because with it #the data won't validate against oai validators. Without, it #validates. @builder.request(provider.url) #-- OAI 2.0 Hack - removed request options yield @builder end end |