Class: OAI::Provider::Response::ListMetadataFormats
- Inherits:
-
RecordResponse
- Object
- Base
- RecordResponse
- OAI::Provider::Response::ListMetadataFormats
- Defined in:
- lib/oai/provider/response/list_metadata_formats.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from RecordResponse
#data_for, #header_for, inherited
Methods inherited from Base
default_parameters, #initialize, required_parameters, #response, valid_parameters
Constructor Details
This class inherits a constructor from OAI::Provider::Response::Base
Instance Method Details
#to_xml ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/oai/provider/response/list_metadata_formats.rb', line 5 def to_xml # Get a list of all the formats the provider understands. formats = provider.formats.values # if it's a doc-specific request if .include?(:identifier) id = extract_identifier([:identifier]) unless record = provider.model.find(id, ) raise OAI::IdException.new end # Remove any format that this particular record can't be provided in. formats.reject! { |f| !record_supports(record, f.prefix) } raise OAI::MetadataFormatException if formats.size == 0 end response do |r| r.ListMetadataFormats do formats.each do |format| r. do r. format.prefix r.schema format.schema r. format.namespace end end end end end |