class Fieldhand::Record
A record is metadata expressed in a single format.
See www.openarchives.org/OAI/openarchivesprotocol.html#Record
Attributes
Public Class Methods
Return a new Record
for the given element with an optional response date.
Defaults the response date to the current time.
# File lib/fieldhand/record.rb, line 16 def initialize(element, response_date = Time.now) @element = element @response_date = response_date end
Public Instance Methods
Return any about elements describing the metadata of this record as an array of strings.
As about elements can be in any format, Fieldhand
does not attempt to parse them but leave that to the user.
# File lib/fieldhand/record.rb, line 65 def about @about ||= element.locate('about').map { |about| Ox.dump(about) } end
Return the UTC datestamp of this item according to its header as a `Date` or `Time` depending on the granularity of this repository.
# File lib/fieldhand/record.rb, line 41 def datestamp header.datestamp end
Test whether this item is marked as deleted or not according to its header.
Note that a repository's support for deleted records can be interrogated through the `Identify` request, see www.openarchives.org/OAI/openarchivesprotocol.html#DeletedRecords
# File lib/fieldhand/record.rb, line 25 def deleted? header.deleted? end
Return the associated Header
for this record.
# File lib/fieldhand/record.rb, line 70 def header @header ||= Header.new(element.header) end
Return the unique identifier of this item according to its header.
# File lib/fieldhand/record.rb, line 35 def identifier header.identifier end
Return the single manifestation of the metadata of this item as a string, if present.
As metadata can be in any format, Fieldhand
does not attempt to parse it but leave that to the user.
# File lib/fieldhand/record.rb, line 58 def metadata @metadata ||= element.locate('metadata[0]').map { |metadata| Ox.dump(metadata, :encoding => 'utf-8', :indent => -1) }.first end
Return any set memberships of this item according to its header.
# File lib/fieldhand/record.rb, line 46 def sets header.sets end
Return the optional status of this item according to its header.
# File lib/fieldhand/record.rb, line 30 def status header.status end
Return this whole item as a string
# File lib/fieldhand/record.rb, line 51 def to_xml Ox.dump(element, :encoding => 'utf-8', :indent => -1) end