class DiscoveryIndexer::Collection

Collection information such as name (title/label) and catkey

Attributes

druid[R]

Public Class Methods

new(druid) click to toggle source
# File lib/discovery-indexer/collection.rb, line 8
def initialize(druid)
  @druid = druid
end

Public Instance Methods

searchworks_id() click to toggle source
# File lib/discovery-indexer/collection.rb, line 12
def searchworks_id
  collection_info[:ckey] || druid
end
title() click to toggle source
# File lib/discovery-indexer/collection.rb, line 16
def title
  collection_info[:title]
end

Private Instance Methods

collection_info() click to toggle source

@return [Hash] the collection data as { title: 'coll title', ckey: catkey'}

# File lib/discovery-indexer/collection.rb, line 23
def collection_info
  return {} unless purl_model
  @info = {}
  @info = { title: purl_model.label, ckey: purl_model.catkey } if @info.empty?
end
purl_model() click to toggle source
# File lib/discovery-indexer/collection.rb, line 29
def purl_model
  @purl_model ||= begin
    DiscoveryIndexer::InputXml::Purlxml.new(druid).load
  rescue => e
    DiscoveryIndexer::Logging.logger.error "There is a problem in retrieving collection name and/or catkey for #{druid}. #{e.inspect}\n#{e.message }\n#{e.backtrace}"
    nil
  end
end