Class: PDCMetadata::Affiliation

Inherits:
Object
  • Object
show all
Defined in:
app/models/pdc_metadata/affiliation.rb

Overview

value: “datacite” identifier: “ror.org/04aj4c181” scheme: “ROR” scheme_uri: “ror.org/”

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value: nil, identifier: nil, scheme: nil, scheme_uri: nil) ⇒ Affiliation

Returns a new instance of Affiliation.



10
11
12
13
14
15
# File 'app/models/pdc_metadata/affiliation.rb', line 10

def initialize(value: nil, identifier: nil, scheme: nil, scheme_uri: nil)
  @value = value
  @identifier = identifier
  @scheme = scheme
  @scheme_uri = scheme_uri
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



9
10
11
# File 'app/models/pdc_metadata/affiliation.rb', line 9

def identifier
  @identifier
end

#schemeObject

Returns the value of attribute scheme.



9
10
11
# File 'app/models/pdc_metadata/affiliation.rb', line 9

def scheme
  @scheme
end

#scheme_uriObject

Returns the value of attribute scheme_uri.



9
10
11
# File 'app/models/pdc_metadata/affiliation.rb', line 9

def scheme_uri
  @scheme_uri
end

#valueObject

Returns the value of attribute value.



9
10
11
# File 'app/models/pdc_metadata/affiliation.rb', line 9

def value
  @value
end

Class Method Details

.new_affiliation(value:, ror: nil) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'app/models/pdc_metadata/affiliation.rb', line 30

def self.new_affiliation(value:, ror: nil)
  scheme = nil
  identifier = nil
  if ror.present?
    scheme = "ROR"
    identifier = ror
  end
  new(value:, scheme:, identifier:, scheme_uri: nil)
end

Instance Method Details

#compare_valueObject



26
27
28
# File 'app/models/pdc_metadata/affiliation.rb', line 26

def compare_value
  "[#{scheme}:#{value}(#{scheme_uri})](#{identifier})"
end

#datacite_attributesObject



17
18
19
20
21
22
23
24
# File 'app/models/pdc_metadata/affiliation.rb', line 17

def datacite_attributes
  {
    value:,
    identifier:,
    identifier_scheme: scheme,
    scheme_uri:
  }
end