Class: Datacite::Mapping::Contributor

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/datacite/mapping/contributor.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, identifier: nil, affiliations: nil, type:) ⇒ Contributor

Initializes a new Datacite::Mapping::Contributor.

Parameters:

  • name (String)

    the personal name of the contributor, in the format Family, Given. Cannot be empty or nil

  • identifier (NameIdentifier, nil) (defaults to: nil)

    an identifier for the contributor. Optional.

  • affiliations (Array<Affiliation>) (defaults to: nil)

    the contributor's affiliations. Defaults to an empty list.

  • type (ContributorType)

    the contributor type. Cannot be nil.



89
90
91
92
93
94
# File 'lib/datacite/mapping/contributor.rb', line 89

def initialize(name:, identifier: nil, affiliations: nil, type:)
  self.name = name
  self.identifier = identifier
  self.affiliations = affiliations || []
  self.type = type
end

Instance Attribute Details

#affiliationsArray<String>

Returns the contributor's affiliations. Defaults to an empty list.

Returns:

  • (Array<String>)

    the contributor's affiliations. Defaults to an empty list.



117
# File 'lib/datacite/mapping/contributor.rb', line 117

array_node :affiliations, 'affiliation', class: String, default_value: []

#identifierNameIdentifier?

Returns an identifier for the contributor. Optional.

Returns:

  • (NameIdentifier, nil)

    an identifier for the contributor. Optional.



113
# File 'lib/datacite/mapping/contributor.rb', line 113

object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil

#nameString

Returns the personal name of the contributor, in the format Family, Given. Cannot be empty or nil.

Returns:

  • (String)

    the personal name of the contributor, in the format Family, Given. Cannot be empty or nil



109
# File 'lib/datacite/mapping/contributor.rb', line 109

text_node :name, 'contributorName'

#typeContributorType

Returns the contributor type. Cannot be nil.

Returns:



121
# File 'lib/datacite/mapping/contributor.rb', line 121

typesafe_enum_node :type, '@contributorType', class: ContributorType