Class: OAI::Record

Inherits:
Object
  • Object
show all
Includes:
XPath
Defined in:
lib/oai/client/record.rb

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 OAI::Header object and the metadata is a REXML::Element object for that chunk of XML.

Note: if your OAI::Client was configured to use the ‘libxml’ parser metadata will return a XML::Node object instead.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XPath

#get_attribute, #xpath, #xpath_all, #xpath_first

Constructor Details

#initialize(element) ⇒ Record

Returns a new instance of Record.



15
16
17
18
# File 'lib/oai/client/record.rb', line 15

def initialize(element)
  @header = OAI::Header.new xpath_first(element, './/header')
  @metadata = xpath_first(element, './/metadata')
end

Instance Attribute Details

#headerObject

Returns the value of attribute header.



13
14
15
# File 'lib/oai/client/record.rb', line 13

def header
  @header
end

#metadataObject

Returns the value of attribute metadata.



13
14
15
# File 'lib/oai/client/record.rb', line 13

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’

Returns:

  • (Boolean)


22
23
24
# File 'lib/oai/client/record.rb', line 22

def deleted?
  return @header.deleted?
end