Sha256: 4009837e86a98fe7da4c167a0cca0914a0765de27f53bbc5e2d2f10fda101052
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
require 'rest-client' class Datacite ENDPOINT = 'https://mds.datacite.org' def initialize(user_name, password) @endpoint = RestClient::Resource.new(ENDPOINT, user_name, password) end def resolve doi begin response = @endpoint["doi/#{doi}"].get rescue Exception => e #error code e.message[0..2] end end def mint doi, url begin response = @endpoint['doi'].post "doi=#{doi}\nurl=#{url}", content_type: "text/plain;charset=UTF-8" rescue Exception => e #error code e.message[0..2] end end def upload_metadata metadata begin response = @endpoint['metadata'].post(metadata,content_type: 'application/xml;charset=UTF-8') rescue Exception => e #error code e.message[0..2] end end def metadata doi begin response = @endpoint["metadata/#{doi}"].get rescue Exception => e #error code e.message[0..2] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
datacite_doi_ify-0.0.1 | lib/datacite_doi_ify/datacite.rb |