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.
16 17 18 19 |
# File 'lib/fieldhand/identify.rb', line 16 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.
11 12 13 |
# File 'lib/fieldhand/identify.rb', line 11 def element @element end |
#response_date ⇒ Object (readonly)
Returns the value of attribute response_date.
11 12 13 |
# File 'lib/fieldhand/identify.rb', line 11 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.
66 67 68 |
# File 'lib/fieldhand/identify.rb', line 66 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
29 30 31 |
# File 'lib/fieldhand/identify.rb', line 29 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.
71 72 73 |
# File 'lib/fieldhand/identify.rb', line 71 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
53 54 55 |
# File 'lib/fieldhand/identify.rb', line 53 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.
78 79 80 |
# File 'lib/fieldhand/identify.rb', line 78 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.
40 41 42 |
# File 'lib/fieldhand/identify.rb', line 40 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.
61 62 63 |
# File 'lib/fieldhand/identify.rb', line 61 def granularity @granularity ||= element.granularity.text end |
#name ⇒ Object
Return the human readable name for the repository.
22 23 24 |
# File 'lib/fieldhand/identify.rb', line 22 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.
34 35 36 |
# File 'lib/fieldhand/identify.rb', line 34 def protocol_version @protocol_version ||= element.protocolVersion.text end |