Class: SulOrcidClient::ContributorMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/sul_orcid_client/contributor_mapper.rb

Overview

Maps a Cocina Contributor to an Orcid Contributor.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contributor:) ⇒ ContributorMapper

Returns a new instance of ContributorMapper.

Parameters:

  • contributor (Cocina::Models::Contributor)

    to map



10
11
12
# File 'lib/sul_orcid_client/contributor_mapper.rb', line 10

def initialize(contributor:)
  @contributor = contributor
end

Class Method Details

.map(contributor:) ⇒ Object



5
6
7
# File 'lib/sul_orcid_client/contributor_mapper.rb', line 5

def self.map(contributor:)
  new(contributor: contributor).map
end

Instance Method Details

#mapObject



14
15
16
17
18
19
20
21
22
# File 'lib/sul_orcid_client/contributor_mapper.rb', line 14

def map
  return unless CocinaSupport.cited?(contributor)

  {
    "credit-name": map_credit_name,
    "contributor-orcid": map_orcid,
    "contributor-attributes": map_attributes
  }.compact
end