Sha256: 33df4962a7ca604c0b6e9393ac1d69cd708aa9d20f33f3b02d29d0c914fe2f45

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 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] the identifier value. Must 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]
        #   the identifier value. Must 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

3 entries across 3 versions & 1 rubygems

Version Path
datacite-mapping-0.1.17.1 lib/datacite/mapping/nonvalidating/identifier.rb
datacite-mapping-0.1.17 lib/datacite/mapping/nonvalidating/identifier.rb
datacite-mapping-0.1.16 lib/datacite/mapping/nonvalidating/identifier.rb