Class: Fieldhand::Identify
- Inherits:
-
Object
- Object
- Fieldhand::Identify
- Defined in:
- lib/fieldhand/identify.rb
Overview
Information about a repository.
See www.openarchives.org/OAI/openarchivesprotocol.html#Identify
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#response_date ⇒ Object
readonly
Returns the value of attribute response_date.
Instance Method Summary collapse
-
#admin_emails ⇒ Object
Return any e-mail addresses of administrators of the repository as an array of strings.
-
#base_url ⇒ Object
Return the base URL of the repository as a URI.
-
#compression ⇒ Object
Return any compression encodings supported by the repository as an array of strings.
-
#deleted_record ⇒ Object
Return the manner in which the repository supports the notion of deleted records as a string.
-
#descriptions ⇒ Object
Return any raw description elements used by communities to describe their repositories as an array of strings.
-
#earliest_datestamp ⇒ Object
Return the guaranteed lower limit of all datestamps recording changes, modifications, or deletions in the repository as a ‘Date` or `Time` depending on the granularity of the repository.
-
#granularity ⇒ Object
Return the finest harvesting granularity supported by the repository.
-
#initialize(element, response_date = Time.now) ⇒ Identify
constructor
Return a new Identify with the given element and optional response date.
-
#name ⇒ Object
Return the human readable name for the repository.
-
#protocol_version ⇒ Object
Return the version of the OAI-PMH protocol supported by the repository as a string.
Constructor Details
#initialize(element, response_date = Time.now) ⇒ Identify
Return a new Identify with the given element and optional response date.
Defaults the response date to the current time.
14 15 16 17 |
# File 'lib/fieldhand/identify.rb', line 14 def initialize(element, response_date = Time.now) @element = element @response_date = response_date end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
9 10 11 |
# File 'lib/fieldhand/identify.rb', line 9 def element @element end |
#response_date ⇒ Object (readonly)
Returns the value of attribute response_date.
9 10 11 |
# File 'lib/fieldhand/identify.rb', line 9 def response_date @response_date end |
Instance Method Details
#admin_emails ⇒ Object
Return any e-mail addresses of administrators of the repository as an array of strings.
64 65 66 |
# File 'lib/fieldhand/identify.rb', line 64 def admin_emails @admin_emails ||= element.locate('adminEmail/^String') end |
#base_url ⇒ Object
Return the base URL of the repository as a URI.
See www.openarchives.org/OAI/openarchivesprotocol.html#HTTPRequestFormat
27 28 29 |
# File 'lib/fieldhand/identify.rb', line 27 def base_url @base_url ||= URI(element.baseURL.text) end |
#compression ⇒ Object
Return any compression encodings supported by the repository as an array of strings.
69 70 71 |
# File 'lib/fieldhand/identify.rb', line 69 def compression @compression ||= element.locate('compression/^String') end |
#deleted_record ⇒ Object
Return the manner in which the repository supports the notion of deleted records as a string.
Possible values are:
-
no
-
transient
-
persistent
See www.openarchives.org/OAI/openarchivesprotocol.html#DeletedRecords
51 52 53 |
# File 'lib/fieldhand/identify.rb', line 51 def deleted_record @deleted_record ||= element.deletedRecord.text end |
#descriptions ⇒ Object
Return any raw description elements used by communities to describe their repositories as an array of strings.
As these can be in any format, Fieldhand does not attempt to parse the elements but leaves that to users.
76 77 78 |
# File 'lib/fieldhand/identify.rb', line 76 def descriptions @descriptions ||= element.locate('description') end |
#earliest_datestamp ⇒ Object
Return the guaranteed lower limit of all datestamps recording changes, modifications, or deletions in the repository as a ‘Date` or `Time` depending on the granularity of the repository.
38 39 40 |
# File 'lib/fieldhand/identify.rb', line 38 def earliest_datestamp @earliest_datestamp ||= Datestamp.parse(element.earliestDatestamp.text) end |
#granularity ⇒ Object
Return the finest harvesting granularity supported by the repository. The legitimate values are YYYY-MM-DD and YYYY-MM-DDThh:mm:ssZ with meanings as defined in ISO 8601.
59 60 61 |
# File 'lib/fieldhand/identify.rb', line 59 def granularity @granularity ||= element.granularity.text end |
#name ⇒ Object
Return the human readable name for the repository.
20 21 22 |
# File 'lib/fieldhand/identify.rb', line 20 def name @name ||= element.repositoryName.text end |
#protocol_version ⇒ Object
Return the version of the OAI-PMH protocol supported by the repository as a string.
32 33 34 |
# File 'lib/fieldhand/identify.rb', line 32 def protocol_version @protocol_version ||= element.protocolVersion.text end |