Class: CatalogHandler
- Inherits:
-
Object
- Object
- CatalogHandler
- Defined in:
- lib/dor/services/metadata_handlers/catalog_handler.rb
Instance Method Summary collapse
Instance Method Details
#fetch(prefix, identifier) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/dor/services/metadata_handlers/catalog_handler.rb', line 6 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
16 17 18 19 20 |
# File 'lib/dor/services/metadata_handlers/catalog_handler.rb', line 16 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
22 23 24 |
# File 'lib/dor/services/metadata_handlers/catalog_handler.rb', line 22 def prefixes %w(catkey barcode) end |