Relaton-DOI: retrieve bibliographic items using DOI
RelatonDoi is a Ruby gem that implements the IsoBibliographicItem model.
You can use it to retrieve metadata of Standards from https://crossref.org, and
access such metadata through the BibliographicItem
object.
To collect metadata this gem makes a few requests to the CrossRef API. It may take a few seconds to get the metadata.
Installation
Add this line to your application’s Gemfile:
gem 'relaton-doi'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install relaton-doi
Usage
Retrieving items of known type using DOI
If the resulting bibliographic item returned from CrossRef is a known Relaton flavor, such as a NIST or IEEE standard, the corresponding Relaton class object will be returned via the call.
require 'relaton_doi'
=> true
# get NIST standard
RelatonDoi::Crossref.get "doi:10.6028/nist.ir.8245"
[relaton-doi] (doi:10.6028/nist.ir.8245) Fetching from search.crossref.org ...
[relaton-doi] (doi:10.6028/nist.ir.8245) Found: `10.6028/nist.ir.8245`
=> #<RelatonNist::NistBibliographicItem:0x00007ff22420d820
...
# get RFC standard
RelatonDoi::Crossref.get "doi:10.17487/RFC0001"
[relaton-doi] (doi:10.17487/RFC0001) Fetching from search.crossref.org ...
[relaton-doi] (doi:10.17487/RFC0001) Found: `10.17487/rfc0001`
[relaton-ietf] WARNING: Invalid doctype report
=> #<RelatonIetf::IetfBibliographicItem:0x00007ff2241be6d0
...
# get BIPM standard
RelatonDoi::Crossref.get "doi:10.1088/0026-1394/29/6/001"
[relaton-doi] (doi:10.1088/0026-1394/29/6/001) Fetching from search.crossref.org ...
[relaton-doi] (doi:10.1088/0026-1394/29/6/001) Found: `10.1088/0026-1394/29/6/001`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f9c846f0a68
...
# get IEEE standard
RelatonDoi::Crossref.get "doi:10.1109/ieeestd.2014.6835311"
[relaton-doi] (doi:10.1109/ieeestd.2014.6835311) Fetching from search.crossref.org ...
[relaton-doi] (doi:10.1109/ieeestd.2014.6835311) Found: `10.1109/ieeestd.2014.6835311`
=> #<RelatonIeee::IeeeBibliographicItem:0x00007f9cb46db688
...
Retrieving items of unknown types via DOI
If the resulting bibliographic item returned from CrossRef is of an unknown type to Relaton, an instance of RelatonBib::BibliographicItem will be returned.
RelatonDoi::Crossref.get "doi:10.1109/ACCESS.2017.2739804"
[relaton-doi] (doi:10.1109/ACCESS.2017.2739804) Fetching from search.crossref.org ...
[relaton-doi] (doi:10.1109/ACCESS.2017.2739804) Found: `10.1109/access.2017.2739804`
=> #<RelatonBib::BibliographicItem:0x00007ff22435e490
...
Logging
RelatonDoi uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the relaton-logger documentation.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run
rake spec
to run the tests. You can also run bin/console
for an interactive
prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To
release a new version, update the version number in version.rb
, and then run
bundle exec rake release
, which will create a git tag for the version, push
git commits and the created tag, and push the .gem
file to
rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-doi.
License
The gem is available as open source under the terms of the MIT License.