relaton-etsi 1.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e6e4ba041c037da56897365348dd11adedc34ea8f92cef0f762995bb7613d8fe
4
+ data.tar.gz: ddf0f3bef8c7d2292ce6a9e34c6d0b70b04df1ad0c5c5d7f2497b81b686080e0
5
+ SHA512:
6
+ metadata.gz: 238a85539e7e015d69242fb759a6d36c22186c664a15b8dc6d1069ed3583bec2517a42860da7f74005f0c68981c985bb1e2c9e6aa4ee419bfdcf0d1e4bbf6271
7
+ data.tar.gz: edfbe1047d23e749c92294ff2cf2b5365344a8873b38c05ed37d1b1af77b6e56e2b6bf1ec6b98e6e835bfde3c22f1bfb8170b23548570c308e1eced5235d6c25
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ # This project follows the Ribose OSS style guide.
2
+ # https://github.com/riboseinc/oss-guides
3
+ # All project-specific additions and overrides should be specified in this file.
4
+
5
+ require: rubocop-rails
6
+
7
+ inherit_from:
8
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
+ AllCops:
10
+ TargetRubyVersion: 2.7
11
+ Rails:
12
+ Enabled: false
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Andrei Kislichenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.adoc ADDED
@@ -0,0 +1,171 @@
1
+ = RelatonEtsi
2
+
3
+ RelatonEtsi is a Ruby gem that implements the https://github.com/relaton/relaton-models#bibliographic-item[BibliographicItem model].
4
+
5
+ You can use it to retrieve metadata of ETSI Standards and access such metadata through the `RelatonEtsi::BibliographicItem` object.
6
+
7
+ == Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ [source,ruby]
12
+ ----
13
+ gem 'relaton-etsi'
14
+ ----
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install relaton-etsi
23
+
24
+ == Usage
25
+
26
+ === Configuration
27
+
28
+ Configuration is optional. The available option is `logger` which is a `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level. To change the logger level, use `RelatonEtsi.configure` block.
29
+
30
+ [source,ruby]
31
+ ----
32
+ require 'relaton_etsi'
33
+ => true
34
+
35
+ RelatonEtsi.configure do |config|
36
+ config.logger.level = Logger::DEBUG
37
+ end
38
+ ----
39
+
40
+ === Search for a standard using keywords
41
+
42
+ [source,ruby]
43
+ ----
44
+ item = RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
45
+ [relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Fetching from Relaton repository ...
46
+ [relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Found: `ETSI GS ZSM 012 V1.1.1 (2022-12)`
47
+ => #<RelatonEtsi::BibliographicItem:0x000000010686fa18
48
+ ...
49
+ ----
50
+
51
+ === XML serialization
52
+
53
+ [source,ruby]
54
+ ----
55
+ item.to_xml
56
+ => "<bibitem id="ETSIGSZSM012V1.1.12022-12" schema-version="v1.2.7">
57
+ <fetched>2023-12-05</fetched>
58
+ <title format="text/plain" language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
59
+ <uri type="src">http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010</uri>
60
+ <uri type="pdf">http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf</uri>
61
+ <docidentifier type="ETSI" primary="true">ETSI GS ZSM 012 V1.1.1 (2022-12)</docidentifier>
62
+ ...
63
+ </bibitem>"
64
+ ----
65
+ With argument `bibdata: true` it outputs XML wrapped by `bibdata` element and adds flavour `ext` element.
66
+ [source,ruby]
67
+ ----
68
+ item.to_xml bibdata: true
69
+ => "<bibdata schema-version="v1.2.7">
70
+ <fetched>2023-12-05</fetched>
71
+ <title format="text/plain" language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
72
+ <uri type="src">http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010</uri>
73
+ <uri type="pdf">http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf</uri>
74
+ <docidentifier type="ETSI" primary="true">ETSI GS ZSM 012 V1.1.1 (2022-12)</docidentifier>
75
+ ...
76
+ <ext schema-version="v0.0.3">
77
+ <doctype abbreviation="GS">Group Specification</doctype>
78
+ <editorialgroup>
79
+ <technical-committee>Zero-touch network and Service Management</technical-committee>
80
+ </editorialgroup>
81
+ </ext>
82
+ </bibdata>"
83
+ ----
84
+
85
+ === Typed links
86
+
87
+ All the ETSI documents have SRC and PDF links. The gem provides a way to access these links through the `RelatonBib::TypedUri` object.
88
+
89
+ [source,ruby]
90
+ ----
91
+ item.link
92
+ => [#<RelatonBib::TypedUri:0x00000001083da780
93
+ @content=#<Addressable::URI:0xb40 URI:http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010>,
94
+ @language=nil,
95
+ @script=nil,
96
+ @type="src">,
97
+ #<RelatonBib::TypedUri:0x00000001083da690
98
+ @content=#<Addressable::URI:0xb54 URI:http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf>,
99
+ @language=nil,
100
+ @script=nil,
101
+ @type="pdf">]
102
+
103
+ item.link.size
104
+ => 2
105
+
106
+ item.link[0].type
107
+ => "src"
108
+
109
+ item.link[0].content.to_s
110
+ => "http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010"
111
+
112
+ item.link[1].type
113
+ => "pdf"
114
+
115
+ item.link[1].content.to_s
116
+ => "http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf"
117
+ ----
118
+
119
+ === Create bibliographic item from XML
120
+ [source,ruby]
121
+ ----
122
+ RelatonEtsi::XMLParser.from_xml File.read('spec/fixtures/bibdata.xml')
123
+ => #<RelatonEtsi::BibliographicItem:0x000000010a7644d0
124
+ ...
125
+ ----
126
+
127
+ === Create bibliographic item from YAML
128
+ [source,ruby]
129
+ ----
130
+ hash = YAML.load_file 'spec/fixtures/item_hash.yaml'
131
+ => {"schema-version"=>"v1.2.7",
132
+ "id"=>"ETSIEN319532-4V1.3.02023-10",
133
+ ...
134
+
135
+ RelatonEtsi::BibliographicItem.from_hash hash
136
+ => #<RelatonEtsi::BibliographicItem:0x000000010a76cf90
137
+ ...
138
+ ----
139
+
140
+ === Fetch data
141
+
142
+ This gem uses the https://www.etsi.org as a data source.
143
+
144
+ The method `RelatonEtsi::DataFetcher.fetch(output: "data", format: "yaml")` fetches all the documents from the data source and saves them to the `./data` folder in YAML format.
145
+ Arguments:
146
+
147
+ - `output` - folder to save documents (default './data').
148
+ - `format` - the format in which the documents are saved. Possible formats are: `yaml`, `xml`, `bibxml` (default `yaml`).
149
+
150
+ [source,ruby]
151
+ ----
152
+ RelatonEtsi::DataFetcher.fetch
153
+ Started at: 2023-12-05 22:44:32 -0500
154
+ Stopped at: 2023-12-05 22:47:55 -0500
155
+ Done in: 204 sec.
156
+ => nil
157
+ ----
158
+
159
+ == Development
160
+
161
+ 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.
162
+
163
+ 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).
164
+
165
+ == Contributing
166
+
167
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-etsi.
168
+
169
+ == License
170
+
171
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec]