class Datacite::Mapping::Contributor

The institution or person responsible for collecting, creating, or otherwise contributing to the developement of the dataset.

Public Class Methods

new(name:, type:, identifier: nil, affiliations: nil) click to toggle source

Initializes a new {Contributor}. @param name [String] the personal name of the contributor, in the format ‘Family, Given`. Cannot be empty or nil @param identifier [NameIdentifier, nil] an identifier for the contributor. Optional. @param affiliations [Array<Affiliation>] the contributor’s affiliations. Defaults to an empty list. @param type [ContributorType] the contributor type. Cannot be nil.

# File lib/datacite/mapping/contributor.rb, line 90
def initialize(name:, type:, identifier: nil, affiliations: nil)
  self.name = name
  self.identifier = identifier
  self.affiliations = affiliations || []
  self.type = type
end

Public Instance Methods

contributor_name=(value) click to toggle source
# File lib/datacite/mapping/contributor.rb, line 109
def contributor_name=(value)
  raise ArgumentError, 'ContributorName cannot be empty or nil' unless value

  @contributor_name = value
end
name() click to toggle source
# File lib/datacite/mapping/contributor.rb, line 115
def name
  @contributor_name&.value
end
name=(value) click to toggle source

name can be entered as a string or a ContributorName object, but it will be stored internally as a ContributorName object

# File lib/datacite/mapping/contributor.rb, line 99
def name=(value)
  raise ArgumentError, 'Name cannot be empty or nil' unless value

  @contributor_name = if value.is_a?(ContributorName)
                        value
                      else
                        ContributorName.new(value: value)
                      end
end
type=(value) click to toggle source
# File lib/datacite/mapping/contributor.rb, line 119
def type=(value)
  raise ArgumentError, 'Type cannot be nil' unless value

  @type = value
end