Sha256: f17eea126058648b2409f96567435e16583f5bb329eb08c76779be1e3ca2ed35

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

require 'xml/mapping'

module Datacite
  module Mapping
    module Nonvalidating

      # The persistent identifier that identifies the resource.
      #
      # @!attribute [r] identifier_type
      #   @return [String] the identifier type (always 'DOI')
      # @!attribute [rw] value
      #   @return [String, nil] the identifier value. Should be a valid DOI value (`10.`_registrant code_`/`_suffix_)
      class Identifier
        include XML::Mapping

        DOI = 'DOI'.freeze

        use_mapping :nonvalidating

        text_node :identifier_type, '@identifierType'
        text_node :value, 'text()', default_value: nil

        fallback_mapping(:_default, :nonvalidating)

        # Initializes a new {Identifier}
        # @param value [String, nil]
        #   the identifier value. Should be a valid DOI value (`10.`_registrant code_`/`_suffix_)
        def initialize(value:)
          self.identifier_type = DOI
          self.value = value
        end

        # Gets the identifiery type.
        def identifier_type
          @identifier_type ||= DOI
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datacite-mapping-0.1.17.2 lib/datacite/mapping/nonvalidating/identifier.rb