Class: Dor::CatalogHandler
- Inherits:
-
Object
- Object
- Dor::CatalogHandler
- Defined in:
- lib/dor/services/metadata_handlers/catalog_handler.rb
Instance Method Summary collapse
Instance Method Details
#fetch(prefix, identifier) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/dor/services/metadata_handlers/catalog_handler.rb', line 7 def fetch(prefix, identifier) client = RestClient::Resource.new(Dor::Config..catalog.url, Dor::Config..catalog.user, Dor::Config..catalog.pass) params = "?#{prefix.chomp}=#{identifier.chomp}" client[params].get rescue RestClient::Exception => e raise BadResponseFromCatalog, "#{e.class} - when contacting (with BasicAuth hidden): #{Dor::Config..catalog.url}#{params}" end |
#label(metadata) ⇒ Object
17 18 19 20 21 |
# File 'lib/dor/services/metadata_handlers/catalog_handler.rb', line 17 def label() mods = Nokogiri::XML() 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(&:text).join(' ').strip end |
#prefixes ⇒ Object
23 24 25 |
# File 'lib/dor/services/metadata_handlers/catalog_handler.rb', line 23 def prefixes %w(catkey barcode) end |