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:

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

  • (defaults to: nil)

    an identifier for the contributor. Optional.

  • (defaults to: nil)

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

  • the contributor type. Cannot be nil.



107
108
109
110
111
112
# File 'lib/datacite/mapping/contributor.rb', line 107

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

Instance Attribute Details

#affiliations ⇒ Array<String>

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

Returns:

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



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

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

#identifier ⇒ NameIdentifier?

Returns an identifier for the contributor. Optional.

Returns:

  • an identifier for the contributor. Optional.



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

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

#name ⇒ String

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

Returns:

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



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

text_node :name, 'contributorName'

#type ⇒ ContributorType

Returns the contributor type. Cannot be nil.

Returns:

  • the contributor type. Cannot be nil.



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

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