Class: Kiba::Extend::Transforms::Marc::LanguageCodeLookup
- Inherits:
-
Object
- Object
- Kiba::Extend::Transforms::Marc::LanguageCodeLookup
- Defined in:
- lib/kiba/extend/transforms/marc/language_code_lookup.rb
Overview
Look up MARC List for Languages codes and provide preferred label value
Instance Method Summary collapse
-
#initialize(source:, target: :language) ⇒ LanguageCodeLookup
constructor
A new instance of LanguageCodeLookup.
-
#process(row) ⇒ Hash{ Symbol => String, nil }
Constructor Details
#initialize(source:, target: :language) ⇒ LanguageCodeLookup
Returns a new instance of LanguageCodeLookup.
27 28 29 30 31 |
# File 'lib/kiba/extend/transforms/marc/language_code_lookup.rb', line 27 def initialize(source:, target: :language) @source = source @target = target @host = URI.parse("https://id.loc.gov").hostname end |
Instance Method Details
#process(row) ⇒ Hash{ Symbol => String, nil }
35 36 37 38 39 40 |
# File 'lib/kiba/extend/transforms/marc/language_code_lookup.rb', line 35 def process(row) Net::HTTP.start(host, use_ssl: true) do |http| row[target] = api_result(http, row[source]) end row end |