Gem Version Build Status (macOS) Build Status (Windows) Build Status (Ubuntu) Code Climate Pull Requests Commits since latest

RelatonOmg is a Ruby gem that searches and fetches standards from The Object Management Group (OMG).

The standards scrape form https://www.omg.org/spec

Installation

Add this line to your application’s Gemfile:

gem 'relaton-omg'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install relaton-omg

Usage

Search document

Reference format is OMG + {ACRONYM} + {VERSION}

require 'relaton_omg'
=> true

item = RelatonOmg::OmgBibliography.get 'OMG AMI4CCM 1.0'
[relaton-omg] (OMG AMI4CCM 1.0) Fetching from www.omg.org ...
[relaton-omg] (OMG AMI4CCM 1.0) Found: `AMI4CCM 1.0`
=> #<RelatonOmg::OmgBibliographicItem:0x000000010435a520
...

# Return nil if the document doesn't exist.
RelatonOmg::OmgBibliography.get 'OMG 1111'
[relaton-omg] (OMG 1111) Fetching from www.omg.org ...
[relaton-omg] (OMG 1111) Not found.
=> nil

Serialization

item.to_xml
=> "<bibitem id="AMI4CCM1.0" schema-version="v1.2.9">
      <fetched>2022-12-05</fetched>
      <title type="main" format="text/plain" language="en" script="Latn">Asynchronous Method Invocation for CCM</title>
      <uri type="src">https://www.omg.org/spec/AMI4CCM/1.0/About-AMI4CCM</uri>
      <uri type="pdf">https://www.omg.org/spec/AMI4CCM/1.0/PDF</uri>
      <docidentifier type="OMG" primary="true">AMI4CCM 1.0</docidentifier>
      ...
    </bibitem>"

OMG documents may have src and pdf link types.

item.link
=> [#<RelatonBib::TypedUri:0x00007fa897a72208 @content=#<Addressable::URI:0x80c URI:https://www.omg.org/spec/AMI4CCM/1.0/About-AMI4CCM/>, @type="src">,
 #<RelatonBib::TypedUri:0x00007fa897a71600 @content=#<Addressable::URI:0x820 URI:https://www.omg.org/spec/AMI4CCM/1.0/PDF>, @type="pdf">]

Create bibliographic item from XML

item = RelatonOmg::OmgBibliographicItem.from_xml 'spec/fixtures/omg_ami4ccm_1_0.xml'
=> #<RelatonOmg::OmgBibliographicItem:0x007fb351582e90
...

Create bibliographic item from Hash

hash = YAML.load_file 'spec/fixtures/omg_ami4ccm_1_0.yaml'
=> {"schema-version"=>"v1.2.9",
 "id"=>"AMI4CCM1.0",
...

item = RelatonOmg::OmgBibliographicItem.from_hash hash
=> #<RelatonOmg::OmgBibliographicItem:0x007f85b0247ec0
...

Create bibliographic item from YAML

item = RelatonOmg::OmgBibliographicItem.from_yaml 'spec/fixtures/omg_ami4ccm_1_0.yaml'
=> #<RelatonOmg::OmgBibliographicItem:0x007f85a00f45d8
...

Logging

RelatonOmg 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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-ietf.

License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).