class StashEzid::Client
Public Class Methods
new(shoulder:, account:, password:, owner:, id_scheme:)
click to toggle source
# File lib/stash_ezid/client.rb, line 5 def initialize(shoulder:, account:, password:, owner:, id_scheme:) @ezid_client = ::Ezid::Client.new(user: account, password: password) @shoulder = shoulder @owner = owner @id_scheme = id_scheme end
Public Instance Methods
mint_id()
click to toggle source
# File lib/stash_ezid/client.rb, line 12 def mint_id identifier = @ezid_client.mint_identifier(@shoulder, {:status => "reserved", :profile => "datacite"}) identifier.id end
update_metadata(identifier, xml_string, target = nil)
click to toggle source
# File lib/stash_ezid/client.rb, line 17 def update_metadata(identifier, xml_string, target = nil) hash = {:status => "public", :datacite => xml_string } hash[:owner] = @owner unless @owner.blank? hash.merge!({:target => target}) if target @ezid_client.modify_identifier(identifier, hash ) end