class OrcidClient::ExternalIdentifier

Constants

SCHEMA

Attributes

orcid[R]
orcid_token[R]
put_code[R]
schema[R]
type[R]
url[R]
validation_errors[R]
value[R]

Public Class Methods

new(type:, value:, url:, orcid:, orcid_token:, **options) click to toggle source
# File lib/orcid_client/external_identifier.rb, line 14
def initialize(type:, value:, url:, orcid:, orcid_token:, **options)
  @type = type
  @value = value
  @url = url
  @orcid = orcid
  @orcid_token = orcid_token
  @put_code = options.fetch(:put_code, nil)
end

Public Instance Methods

data() click to toggle source
# File lib/orcid_client/external_identifier.rb, line 25
def data
  Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
    xml.send(:'external-identifier:external-identifier', root_attributes) do
      insert_external_identifier(xml)
    end
  end.to_xml
end
insert_external_identifier(xml) click to toggle source
# File lib/orcid_client/external_identifier.rb, line 33
def insert_external_identifier(xml)
  insert_id(xml)
end
insert_id(xml) click to toggle source
# File lib/orcid_client/external_identifier.rb, line 37
def insert_id(xml)
  xml.send(:'common:external-id-type', type)
  xml.send(:'common:external-id-value', value)
  xml.send(:'common:external-id-url', url)
  xml.send(:'common:external-id-relationship', "self")
end
root_attributes() click to toggle source
# File lib/orcid_client/external_identifier.rb, line 44
def root_attributes
  { :'put-code' => put_code,
    :'visibility' => 'public',
    :'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
    :'xsi:schemaLocation' => 'http://www.orcid.org/ns/external-identifier ../person-external-identifier-3.0.xsd',
    :'xmlns:common' => 'http://www.orcid.org/ns/common',
    :'xmlns:external-identifier' => 'http://www.orcid.org/ns/external-identifier' }.compact
end