Module: Bolognese::Writers::HyraxWorkWriter

Defined in:
app/services/bolognese/writers/hyrax_work_writer.rb

Overview

Use this with Bolognese like the following: m = Bolognese::Metadata.new(input: ‘10.18130/v3-k4an-w022’) Then crosswalk it with: m.hyrax_work

Instance Method Summary collapse

Instance Method Details

#hyrax_workObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/services/bolognese/writers/hyrax_work_writer.rb', line 11

def hyrax_work
  attributes = {
    'identifier' => Array(identifiers).select { |id| id["identifierType"] != "DOI" }.pluck("identifier"),
    'doi' => build_hyrax_work_doi,
    'title' => titles&.pluck("title"),
    # FIXME: This may not roundtrip since datacite normalizes the creator name
    'creator' => creators&.pluck("name"),
    'contributor' => contributors&.pluck("name"),
    'publisher' => Array(publisher),
    'date_created' => Array(publication_year),
    'description' => build_hyrax_work_description,
    'keyword' => subjects&.pluck("subject")
  }
  hyrax_work_class = determine_hyrax_work_class
  # Only pass attributes that the work type knows about
  hyrax_work_class.new(attributes.slice(*hyrax_work_class.attribute_names))
end