Method: OrcidClient::Work#contributors

Defined in:
lib/orcid_client/work.rb

#contributorsObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/orcid_client/work.rb', line 45

def contributors
  Array.wrap(.creators).map do |contributor|
    orcid = Array.wrap(contributor["nameIdentifiers"]).find { |c| c["nameIdentifierScheme"] == "ORCID" }.to_h.fetch("nameIdentifier", nil)
    credit_name = contributor["familyName"].present? ? [contributor["givenName"], contributor["familyName"]].join(" ") : contributor["name"]

    { orcid: orcid,
      credit_name: credit_name,
      role: nil }.compact
  end
end