Class: Fieldhand::Identify

Inherits:
Object
  • Object
show all
Defined in:
lib/fieldhand/identify.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#elementObject (readonly)

Returns the value of attribute element.



11
12
13
# File 'lib/fieldhand/identify.rb', line 11

def element
  @element
end

#response_dateObject (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_emailsObject

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_urlObject

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

#compressionObject

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_recordObject

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

#descriptionsObject

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_datestampObject

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

#granularityObject

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.

See www.w3.org/TR/NOTE-datetime



61
62
63
# File 'lib/fieldhand/identify.rb', line 61

def granularity
  @granularity ||= element.granularity.text
end

#nameObject

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_versionObject

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