Sha256: 615a1170933e3ccf400f82d57ab828d4ec5a9d331996e2e37f1a1b41205c95dc

Contents?: true

Size: 560 Bytes

Versions: 60

Compression:

Stored size: 560 Bytes

Contents

require 'rest-client'

handler = Class.new do
  def fetch(prefix, identifier)
    client = RestClient::Resource.new(Dor::Config.metadata.catalog.url)
    client["?#{prefix.chomp}=#{identifier.chomp}"].get
  end

  def label(metadata)
    mods = Nokogiri::XML(metadata)
    mods.root.add_namespace_definition('mods', 'http://www.loc.gov/mods/v3')
    mods.xpath('/mods:mods/mods:titleInfo[1]').xpath('mods:title|mods:nonSort').collect { |n| n.text }.join(' ').strip
  end

  def prefixes
    %w(catkey barcode)
  end
end

Dor::MetadataService.register(handler)

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
dor-services-5.29.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.28.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.27.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.26.3 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.26.2 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.26.1 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.26.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.25.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.24.1 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.24.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.23.1 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.23.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.22.3 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.22.2 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.22.1 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.22.0 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.21.4 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.21.3 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.21.2 lib/dor/services/metadata_handlers/catalog_handler.rb
dor-services-5.21.1 lib/dor/services/metadata_handlers/catalog_handler.rb