Class: DiscoveryIndexer::InputXml::PurlxmlReader

Inherits:
Object
  • Object
show all
Defined in:
lib/discovery-indexer/reader/purlxml_reader.rb

Class Method Summary collapse

Class Method Details

.read(druid) ⇒ Nokogiri::XML::Document

reads the public xml for the fedora object that is defined , from the purl server

Parameters:

  • druid (String)

    e.g. ab123cd4567

Returns:

  • (Nokogiri::XML::Document)

    the public xml for the fedora object

Raises:

  • (MissingPublicXml)

    if there’s no purl xml available for this druid



10
11
12
13
14
15
16
17
# File 'lib/discovery-indexer/reader/purlxml_reader.rb', line 10

def self.read(druid)
  purlxml_uri = "#{DiscoveryIndexer::PURL_DEFAULT}/#{druid}.xml"
  begin
    Nokogiri::XML(open(purlxml_uri))
  rescue
    raise DiscoveryIndexer::Errors::MissingPurlPage.new(purlxml_uri)
  end
end