Class: DiscoveryIndexer::InputXml::Purlxml

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

Overview

Main model class to access the parsed purl xml retrieved from PURL server

then you can access the bits of interest
  model.collection_druids

Examples:

to run the code

druid = "aa111aa1111"
p =  DiscoveryIndexer::InputXml::Purlxml.new(druid)
model =  p.load()

Instance Method Summary collapse

Constructor Details

#initialize(druid) ⇒ Purlxml

initializes a new object

Parameters:

  • druid (String)

    the druid object in the format “aa111aa1111”



13
14
15
16
17
# File 'lib/discovery-indexer/reader/purlxml.rb', line 13

def initialize(druid)
  @druid = druid
  @purlxml_ng_doc = nil
  @populated_model = nil
end

Instance Method Details

#loadPurlxmlModel

loads the purl xml to purlxml model for the fedora object defind in the druid, it reads the purl xml once from PURL server, and repeat the parsing with each call

Returns:



22
23
24
25
# File 'lib/discovery-indexer/reader/purlxml.rb', line 22

def load
  @purlxml_ng_doc ||= PurlxmlReader.read(@druid)
  @populated_model ||= PurlxmlParserStrict.new(@druid, @purlxml_ng_doc).parse
end