Sha256: 9657a37823d5fd5a0122aabfa9fe37e2254d945cce8a341a9cd71e2305ab7e13
Contents?: true
Size: 938 Bytes
Versions: 3
Compression:
Stored size: 938 Bytes
Contents
module RelatonDoi module Crossref extend self # # Get a document by DOI from the CrossRef API. # # @param [String] doi The DOI. # # @return [RelatonBib::BibliographicItem, RelatonIetf::IetfBibliographicItem, # RelatonBipm::BipmBibliographicItem, RelatonIeee::IeeeBibliographicItem, # RelatonNist::NistBibliographicItem] The bibitem. # def get(doi) Util.warn "(#{doi}) Fetching from search.crossref.org ..." id = doi.sub(%r{^doi:}, "") message = get_by_id id Util.warn "(#{doi}) Found: `#{message['DOI']}`" Parser.parse message rescue Serrano::NotFound Util.warn "(#{doi}) Not found." nil end # # Get a document by DOI from the CrossRef API. # # @param [String] id The DOI. # # @return [Hash] The document. # def get_by_id(id) resp = Serrano.works ids: id resp[0]["message"] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
relaton-doi-1.18.0 | lib/relaton_doi/crossref.rb |
relaton-doi-1.17.0 | lib/relaton_doi/crossref.rb |
relaton-doi-1.16.2 | lib/relaton_doi/crossref.rb |