class Ddr::Models::FindingAid
Constants
- EAD_XMLNS
Attributes
ead_id[R]
Public Class Methods
new(ead_id)
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 10 def initialize(ead_id) @ead_id = ead_id end
Public Instance Methods
abstract()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 43 def abstract collection.xpath('ead:did/ead:abstract', ead: EAD_XMLNS).text end
collection_date_span()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 27 def collection_date_span collection.xpath('ead:did/ead:unitdate[@type="inclusive"]', ead: EAD_XMLNS).text end
collection_number()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 31 def collection_number collection.xpath('ead:did/ead:unitid', ead: EAD_XMLNS).text end
collection_title()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 35 def collection_title collection.xpath('ead:did/ead:unittitle', ead: EAD_XMLNS).text end
extent()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 39 def extent collection.xpath('ead:did/ead:physdesc/ead:extent', ead: EAD_XMLNS).map(&:text).join("; ") end
repository()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 23 def repository collection.xpath('ead:did/ead:repository/ead:corpname', ead: EAD_XMLNS).text end
title()
click to toggle source
The finding aid title
# File lib/ddr/models/finding_aid.rb, line 19 def title doc.css("titleproper").children.first.text.strip end
url()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 14 def url doc.css("eadid").attr("url").text end
Private Instance Methods
collection()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 49 def collection doc.xpath('//ead:archdesc[@level="collection"]', ead: EAD_XMLNS) end
doc()
click to toggle source
@raise [OpenURI::HTTPError] if 404, etc.
# File lib/ddr/models/finding_aid.rb, line 54 def doc @doc ||= Nokogiri::XML(open(ead_xml_url)) end
ead_xml_url()
click to toggle source
# File lib/ddr/models/finding_aid.rb, line 58 def ead_xml_url Ddr::Models.ead_xml_base_url + ead_id + ".xml" end