Class: Fieldhand::ListRecordsParser

Inherits:
Object
  • Object
show all
Defined in:
lib/fieldhand/list_records_parser.rb

Overview

A parser for ListRecords responses.

See www.openarchives.org/OAI/openarchivesprotocol.html#ListRecords

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_parser) ⇒ ListRecordsParser

Return a parser for the given response body.



11
12
13
# File 'lib/fieldhand/list_records_parser.rb', line 11

def initialize(response_parser)
  @response_parser = response_parser
end

Instance Attribute Details

#response_parserObject (readonly)

Returns the value of attribute response_parser.



8
9
10
# File 'lib/fieldhand/list_records_parser.rb', line 8

def response_parser
  @response_parser
end

Instance Method Details

#itemsObject

Return an array of ‘Record`s found in the response.



16
17
18
19
20
21
# File 'lib/fieldhand/list_records_parser.rb', line 16

def items
  response_parser.
    root.
    locate('ListRecords/record').
    map { |item| Record.new(item, response_parser.response_date) }
end