Skip to content

Commit

Permalink
Merge pull request #44 from code4lib/oai-record
Browse files Browse the repository at this point in the history
Expose the source data for an OAI::Record
  • Loading branch information
Thomas Johnson committed May 8, 2015
2 parents 0e8d143 + 9fa768e commit e6d6e81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/oai/client/record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ module OAI
# metadata will return a `XML::Node` object instead.
class Record
include OAI::XPath
attr_accessor :header, :metadata, :about
attr_accessor :header, :metadata, :about, :_source

def initialize(element)
@_source = element
@header = OAI::Header.new xpath_first(element, './/header')
@metadata = xpath_first(element, './/metadata')
@about = xpath_first(element, './/about')
Expand Down
1 change: 1 addition & 0 deletions test/client/tc_get_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def test_get_one
response = client.get_record :identifier => 'oai:test/3'
assert_kind_of OAI::GetRecordResponse, response
assert_kind_of OAI::Record, response.record
assert_kind_of REXML::Element, response.record._source
assert_kind_of REXML::Element, response.record.metadata
assert_kind_of OAI::Header, response.record.header
assert_kind_of REXML::Element, response.record.about
Expand Down

0 comments on commit e6d6e81

Please sign in to comment.