RelatonItu is a Ruby gem that implements the IsoBibliographicItem model.
Installation
Add this line to your application’s Gemfile:
gem 'relaton-bib'
And then execute:
$ bundle
Or install it yourself as:
$ gem install relaton-bib
Usage
Search for a standard using keywords
require 'relaton_itu'
hit_collection = RelatonItu::ItuBibliography.search("ITU-T L.163")
=> <RelatonItu::HitCollection:0x007fbf5fb4ab60 @ref=ITU-T L.163 @fetched=false>
item = hit_collection[1].fetch
=> #<RelatonItu::ItuBibliographicItem:0x007fbf1fc89548
...
XML serialization
item.to_xml
=> "<bibitem id="ITU-TL.1470" type="standard">
<fetched>2019-06-07</fetched>
<title type="title-main" format="text/plain" language="en" script="Latn">ITU-T J.163 (12/2007): Dynamic quality of service for the provision of real-time services over cable television networks using cable modems</title>
<title type="main" format="text/plain" language="en" script="Latn">ITU-T J.163 (12/2007): Dynamic quality of service for the provision of real-time services over cable television networks using cable modems</title>
<uri type="src">https://www.itu.int/net4/ITU-T/search/api/redirection?dest=http%3A%2F%2Fhandle.itu.int%2F11.1002%2F1000%2F9306-en&position=9&page=1</uri>
<uri type="obp">https://www.itu.int/rec/T-REC-J.163-200712-I</uri>
<docidentifier type="ITU">ITU-T J.163 (12/2007)</docidentifier>
...
</bibitem>"
With bibdata: true
option XML output wrapped with bibdata
element and ext
element added.
item.to_xml bibdata: true
=> "<bibdata type="standard">
<fetched>2019-06-07</fetched>
...
<ext>
<doctype>recommendation</doctype>
<editorialgroup>
<bureau>T</bureau>
<group type="study-group">
<name>ITU-T Study Group 9</name>
<acronym>SG</acronym>
</group>
</editorialgroup>
</ext>
</bibdata>"
Get code, and year
RelatonItu::ItuBibliography.get("ITU-T L.163", "2018", {})
[relaton-itu] ("ITU-T L.163") fetching...
[relaton-itu] ("ITU-T L.163") found ITU-T L.163
=> #<RelatonItu::ItuBibliographicItem:0x007fbf5f94b9b8
...
Get amendment
RelatonItu::ItuBibliography.get "ITU-T G.989.2/Amd 1"
[relaton-itu] ("ITU-T G.989.2/Amd 1") fetching...
[relaton-itu] ("ITU-T G.989.2/Amd 1") found ITU-T G.989.2/Amd 1
=> #<RelatonItu::ItuBibliographicItem:0x007fe5409e5840
...
Get ITU-R documents
RelatonItu::ItuBibliography.get "ITU-R REC-BO.600-1"
[relaton-itu] ("ITU-R REC-BO.600-1") fetching...
[relaton-itu] ("ITU-R REC-BO.600-1") found R-REC-BO.600-1
=> #<RelatonItu::ItuBibliographicItem:0x007f84e9930498
...
Get ITU-R Radio Regulations (RR)
RelatonItu::ItuBibliography.get 'ITU-R RR (2020)'
[relaton-itu] ("ITU-R RR") fetching...
[relaton-itu] WARNING: invalid doctype: publication
[relaton-itu] ("ITU-R RR") found ITU-R RR
=> #<RelatonItu::ItuBibliographicItem:0x007fb4b55eb660
...
Create bibliographic item form YAML
hash = YAML.load_file 'spec/examples/itu_bib_item.yml'
=> {"id"=>"ITU-T L.163 (11/2018)",
...
RelatonItu::ItuBibliographicItem.from_hash hash
=> #<RelatonItu::ItuBibliographicItem:0x007fd88ac02aa0
...
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 tags, and push the .gem
file to [rubygems.org](https://rubygems.org).
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-bib.
License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).