README.adoc in relaton-iana-1.13.1 vs README.adoc in relaton-iana-1.14.0

- old
+ new

@@ -1,10 +1,10 @@ = RelatonIana RelatonIana is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model]. -You can use it to retrieve metadata of W3C Standards from https://w3.org, and access such metadata through the `BibliographicItem` object. +You can use it to retrieve metadata of W3C Standards from https://w3.org, and access such metadata through the `IanaBibliographicItem` object. == Installation Add this line to your application's Gemfile: @@ -31,38 +31,26 @@ => true item = RelatonIana::IanaBibliography.get "IANA service-names-port-numbers" [relaton-iana] ("IANA service-names-port-numbers") fetching... [relaton-iana] ("IANA service-names-port-numbers") found IANA service-names-port-numbers -=> #<RelatonBib::BibliographicItem:0x00007f7c6cc024d0 +=> #<RelatonIana::IanaBibliographicItem:0x00007f7c6cc024d0 ... ---- === XML serialization [source,ruby] ---- item.to_xml -=> "<bibitem id="IANAservice-names-port-numbers" type="standard"> - <fetched>2021-11-24</fetched> - <title format="text/plain">Service Name and Transport Protocol Port Number Registry</title> - <uri type="src">http://www.iana.org/assignments/service-names-port-numbers</uri> - <docidentifier type="IANA">IANA service-names-port-numbers</docidentifier> - <docnumber>service-names-port-numbers</docnumber> - <date type="updated"> - <on>2021-11-12</on> - </date> - <contributor> - <role type="publisher"/> - <organization> - <name>Internet Assigned Numbers Authority</name> - <abbreviation>IANA</abbreviation> - </organization> - </contributor> - <language>en</language> - <script>Latn</script> -</bibitem>" +=> "<bibitem id="IANAservice-names-port-numbers" type="standard" schema-version="v1.2.1"> + <fetched>2022-12-03</fetched> + <title format="text/plain">Service Name and Transport Protocol Port Number Registry</title> + <uri type="src">http://www.iana.org/assignments/service-names-port-numbers</uri> + <docidentifier type="IANA" primary="true">IANA service-names-port-numbers</docidentifier> + ... + </bibitem>" ---- === Typed links Each IANA document has `src` type link. @@ -77,54 +65,54 @@ ---- === Create bibliographic item from XML [source,ruby] ---- -RelatonBib::XMLParser.from_xml File.read('spec/fixtures/service-names-port-numbers.xml') -=> #<RelatonBib::BibliographicItem:0x00007f7c6b837248 +RelatonIana::XMLParser.from_xml File.read('spec/fixtures/auto-response-parameters.xml') +=> #<RelatonIana::IanaBibliographicItem:0x00007fa5da1bd118 ... ---- === Create bibliographic item from YAML [source,ruby] ---- -hash = YAML.load_file 'spec/fixtures/service-names-port-numbers.yaml' -=> {"id"=>"IANAservice-names-port-numbers", - "title"=>{"content"=>"Service Name and Transport Protocol Port Number Registry", "format"=>"text/plain"}, +YAML.load_file 'spec/fixtures/auto-response-parameters.yaml' +=> {"schema-version"=>"v1.2.1", + "id"=>"IANAauto-response-parameters", ... bib_hash = RelatonIana::HashConverter.hash_to_bib hash -=> {:id=>"IANAservice-names-port-numbers", - :title=>{:content=>"Service Name and Transport Protocol Port Number Registry", :format=>"text/plain"}, +=> {:"schema-version"=>"v1.2.1", + :id=>"IANAauto-response-parameters", ... -RelatonBib::BibliographicItem.new **bib_hash -=> #<RelatonBib::BibliographicItem:0x007f9381ec6a00 +RelatonIana::IanaBibliographicItem.new **bib_hash +=> #<RelatonIana::IanaBibliographicItem:0x007f9381ec6a00 ... ---- === Fetch data -There is a IANA dataset https://github.com/ietf-ribose/iana-registries which can be converted into RelatonXML/BibXML/BibYAML formats. +There is an IANA dataset https://github.com/ietf-ribose/iana-registries which can be converted into RelatonXML/BibXML/BibYAML formats. -The method `RelatonIana::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the dataset and save them to the `./data` folder in YAML format. +The method `RelatonIana::DataFetcher.fetch(output: "data", format: "yaml")` converts all the documents from the dataset and saves them to the `./data` folder in YAML format. Arguments: - `output` - folder to save documents (default './data'). -- `format` - format in which the documents are saved. Possimle formats are: `yaml`, `xml`, `bibxml` (default `yaml`). +- `format` - the format in which the documents are saved. Possible formats are: `yaml`, `xml`, `bibxml` (default `yaml`). [source,ruby] ---- RelatonIana::DataFetcher.fetch Started at: 2021-11-19 13:32:05 +0100 Stopped at: 2021-11-19 13:34:40 +0100 Done in: 155 sec. => nil ---- -This method uses GitHub search API to fetch the documents. The search API has a https://docs.github.com/en/rest/reference/search#rate-limit[rate limitaion] of 30 requests per minute for authenticated users and 10 requests per minute for unauthenticated users. Usually, the rate limit is not reached because the search API is used only for the files list fetching. But if you run the method multiple times in a short period, it is possible that the rate limit will be reached. In this case, the method will wait until the rate limit is reset. +This method uses GitHub search API to fetch the documents. The search API has a https://docs.github.com/en/rest/reference/search#rate-limit[rate limitaion] of 30 requests per minute for authenticated users and 10 requests per minute for unauthenticated users. Usually, the rate limit is not reached because the search API is used only for the file list fetching. But if you run the method multiple times in a short period, the rate limit may be reached. In this case, the method will wait until the rate limit is reset. -You can use pesonal access token to increase the rate limit. To do this, add your pesonal access token to the `GITHUB_TOKEN` environment variable. +You can use a personal access token to increase the rate limit. To do this, add your personal access token to the `GITHUB_TOKEN` environment variable. == 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.