Class: OAI::Record
Overview
A class for representing a Record as returned from a ‘GetRecord` or `ListRecords` request. Each record will have a header and metadata attribute. The header is a Header object and the metadata is a `REXML::Element` object for that chunk of XML.
Note: if your Client was configured to use the ‘libxml’ parser metadata will return a ‘XML::Node` object instead.
Instance Attribute Summary collapse
-
#_source ⇒ Object
Returns the value of attribute _source.
-
#about ⇒ Object
Returns the value of attribute about.
-
#header ⇒ Object
Returns the value of attribute header.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#deleted? ⇒ Boolean
a convenience method which digs into the header status attribute and returns true if the value is set to ‘deleted’.
-
#initialize(element) ⇒ Record
constructor
A new instance of Record.
Methods included from XPath
#get_attribute, #xpath, #xpath_all, #xpath_first
Constructor Details
#initialize(element) ⇒ Record
Returns a new instance of Record.
14 15 16 17 18 19 |
# File 'lib/oai/client/record.rb', line 14 def initialize(element) @_source = element @header = OAI::Header.new xpath_first(element, './/header') @metadata = xpath_first(element, './/metadata') @about = xpath_first(element, './/about') end |
Instance Attribute Details
#_source ⇒ Object
Returns the value of attribute _source.
12 13 14 |
# File 'lib/oai/client/record.rb', line 12 def _source @_source end |
#about ⇒ Object
Returns the value of attribute about.
12 13 14 |
# File 'lib/oai/client/record.rb', line 12 def about @about end |
#header ⇒ Object
Returns the value of attribute header.
12 13 14 |
# File 'lib/oai/client/record.rb', line 12 def header @header end |
#metadata ⇒ Object
Returns the value of attribute metadata.
12 13 14 |
# File 'lib/oai/client/record.rb', line 12 def @metadata end |
Instance Method Details
#deleted? ⇒ Boolean
a convenience method which digs into the header status attribute and returns true if the value is set to ‘deleted’
23 24 25 |
# File 'lib/oai/client/record.rb', line 23 def deleted? return @header.deleted? end |