Class: Skala::PrimoAdapter::Search::ResultTransformation::DocTransformation::SetIdentifier

Inherits:
Transformator::Transformation::Step
  • Object
show all
Defined in:
lib/skala/primo_adapter/search/result_transformation/doc_transformation/set_identifier.rb

Instance Method Summary collapse

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/skala/primo_adapter/search/result_transformation/doc_transformation/set_identifier.rb', line 7

def call
  sanitizer = Rails::Html::FullSanitizer.new

  identifier_strings = transformation.read_source_values(".//display/identifier", split: ";")
  identifier_strings.map!{|s| sanitizer.sanitize(s)}

  isbns = extract_isbns(identifier_strings)
  issns = extract_issns(identifier_strings)
  dois  = extract_dois(identifier_strings)

  target.record.isbn = isbns
  target.record.issn = issns
  target.record.identifier = dois.map{|i| {type: "doi", value: i}}
end