Class: OAI::Provider::Response::ListIdentifiers
- Inherits:
-
RecordResponse
- Object
- Base
- RecordResponse
- OAI::Provider::Response::ListIdentifiers
- Defined in:
- lib/oai/provider/response/list_identifiers.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
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_identifiers.rb', line 6 def to_xml result = provider.model.find(:all, ) # result may be an array of records, or a partial result records = result.respond_to?(:records) ? result.records : result raise OAI::NoMatchException.new if records.nil? or records.empty? format = requested_format # not call this in each iteration records.reject! do |r| !record_supports(r, format) end response do |r| r.ListIdentifiers do records.each do |rec| header_for rec end # append resumption token for getting next group of records if result.respond_to?(:token) r.target! << result.token.to_xml end end end end |