Sha256: 32cb507597d331515e4a9bce0a7d5a7b01437c33a9ee5911b9241d85b5a38b20

Contents?: true

Size: 503 Bytes

Versions: 12

Compression:

Stored size: 503 Bytes

Contents

module Ddr::Models
  class FindingAid

    attr_reader :ead_id

    def initialize(ead_id)
      @ead_id = ead_id
    end

    def url
      @url ||= doc.css("eadid").attr("url").text
    end

    def title
      @title ||= doc.css("titleproper").children.first.text.strip
    end

    private

    # @raise [OpenURI::HTTPError] if 404, etc.
    def doc
      @doc ||= Nokogiri::XML(open(ead_xml_url))
    end

    def ead_xml_url
      Ddr::Models.ead_xml_base_url + ead_id + ".xml"
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ddr-models-3.0.0.beta.3 lib/ddr/models/finding_aid.rb
ddr-models-3.0.0.beta.2 lib/ddr/models/finding_aid.rb
ddr-models-3.0.0.beta.1 lib/ddr/models/finding_aid.rb
ddr-models-3.0.0.alpha.4 lib/ddr/models/finding_aid.rb
ddr-models-3.0.0.alpha.3 lib/ddr/models/finding_aid.rb
ddr-models-3.0.0.alpha.2 lib/ddr/models/finding_aid.rb
ddr-models-3.0.0.alpha.1 lib/ddr/models/finding_aid.rb
ddr-models-2.1.3 lib/ddr/models/finding_aid.rb
ddr-models-2.1.2 lib/ddr/models/finding_aid.rb
ddr-models-2.1.1 lib/ddr/models/finding_aid.rb
ddr-models-2.1.0 lib/ddr/models/finding_aid.rb
ddr-models-2.1.0.rc2 lib/ddr/models/finding_aid.rb