class Fieldhand::Record

A record is metadata expressed in a single format.

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

Attributes

element[R]
response_date[R]

Public Class Methods

new(element, response_date = Time.now) click to toggle source

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

about() click to toggle source

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
datestamp() click to toggle source

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
deleted?() click to toggle source

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
header() click to toggle source

Return the associated Header for this record.

# File lib/fieldhand/record.rb, line 70
def header
  @header ||= Header.new(element.header)
end
identifier() click to toggle source

Return the unique identifier of this item according to its header.

# File lib/fieldhand/record.rb, line 35
def identifier
  header.identifier
end
metadata() click to toggle source

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
sets() click to toggle source

Return any set memberships of this item according to its header.

# File lib/fieldhand/record.rb, line 46
def sets
  header.sets
end
status() click to toggle source

Return the optional status of this item according to its header.

# File lib/fieldhand/record.rb, line 30
def status
  header.status
end
to_xml() click to toggle source

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