relaton-etsi 1.18.0 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +5 -12
- data/grammars/basicdoc.rng +3 -0
- data/lib/relaton_etsi/bibliographic_item.rb +8 -4
- data/lib/relaton_etsi/bibliography.rb +3 -3
- data/lib/relaton_etsi/document_type.rb +2 -2
- data/lib/relaton_etsi/hash_converter.rb +13 -0
- data/lib/relaton_etsi/util.rb +1 -4
- data/lib/relaton_etsi/version.rb +1 -1
- data/lib/relaton_etsi/xml_parser.rb +4 -0
- data/lib/relaton_etsi.rb +0 -1
- metadata +22 -9
- data/lib/relaton_etsi/config.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81c7a95a6b38369cc2700680b2c39f3d8d75fff3761123e4fb87565a2f04dc2d
|
4
|
+
data.tar.gz: 29d1ac8bd79de191815a29a055189d05de180f964f095f3f6bdd5f77721ed892
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4d477ef680da1638a383cf1fcf4b04ef2fd9afc0e5687846868376063e194d45be309cea28ceccaee49714dded0f1eb46e52eae7c0b6cf41fd6e00e716e18f0
|
7
|
+
data.tar.gz: deebba6853e866f7ea6814aeabe5c07285fcc7c02fe69d2b47a6436acda8958fdd42a03e08e2b18703791cc344fe1843b45bdd44e3fc4169dc67f997c05c6438
|
data/README.adoc
CHANGED
@@ -23,24 +23,13 @@ Or install it yourself as:
|
|
23
23
|
|
24
24
|
== Usage
|
25
25
|
|
26
|
-
===
|
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.
|
26
|
+
=== Search for a standard using keywords
|
29
27
|
|
30
28
|
[source,ruby]
|
31
29
|
----
|
32
30
|
require 'relaton_etsi'
|
33
31
|
=> true
|
34
32
|
|
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
33
|
item = RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
|
45
34
|
[relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Fetching from Relaton repository ...
|
46
35
|
[relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Found: `ETSI GS ZSM 012 V1.1.1 (2022-12)`
|
@@ -156,6 +145,10 @@ Done in: 204 sec.
|
|
156
145
|
=> nil
|
157
146
|
----
|
158
147
|
|
148
|
+
=== Logging
|
149
|
+
|
150
|
+
RelatonEtsi uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
|
151
|
+
|
159
152
|
== Development
|
160
153
|
|
161
154
|
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.
|
data/grammars/basicdoc.rng
CHANGED
@@ -55,13 +55,17 @@ module RelatonEtsi
|
|
55
55
|
|
56
56
|
def to_hash # rubocop:disable Metrics/AbcSize
|
57
57
|
hash = super
|
58
|
-
hash["marker"] = marker if marker
|
59
|
-
hash["frequency"] = frequency if frequency.any?
|
60
|
-
hash["mandate"] = mandate if mandate.any?
|
61
|
-
hash["custom_collection"] = custom_collection if custom_collection
|
58
|
+
hash["ext"]["marker"] = marker if marker
|
59
|
+
hash["ext"]["frequency"] = frequency if frequency.any?
|
60
|
+
hash["ext"]["mandate"] = mandate if mandate.any?
|
61
|
+
hash["ext"]["custom_collection"] = custom_collection if custom_collection
|
62
62
|
hash
|
63
63
|
end
|
64
64
|
|
65
|
+
def has_ext?
|
66
|
+
super || marker || frequency.any? || mandate.any? || custom_collection
|
67
|
+
end
|
68
|
+
|
65
69
|
def to_asciibib(prefix = "") # rubocop:disable Metrics/AbcSize
|
66
70
|
out = super
|
67
71
|
pref = prefix.empty? ? prefix : "#{prefix}."
|
@@ -32,14 +32,14 @@ module RelatonEtsi
|
|
32
32
|
# @param opts [Hash] options
|
33
33
|
# @return [RelatonEtsi::BibliographicItem]
|
34
34
|
def get(ref, _year = nil, _opts = {})
|
35
|
-
Util.
|
35
|
+
Util.info "Fetching from Relaton repository ...", key: ref
|
36
36
|
result = search(ref)
|
37
37
|
unless result
|
38
|
-
Util.
|
38
|
+
Util.info "Not found.", key: ref
|
39
39
|
return
|
40
40
|
end
|
41
41
|
|
42
|
-
Util.
|
42
|
+
Util.info "Found: `#{result.docidentifier[0].id}`", key: ref
|
43
43
|
result
|
44
44
|
end
|
45
45
|
|
@@ -34,13 +34,13 @@ module RelatonEtsi
|
|
34
34
|
def check_type(type)
|
35
35
|
return if DOCTYPES.value? type
|
36
36
|
|
37
|
-
Util.warn "
|
37
|
+
Util.warn "invalid doctype: `#{type}`"
|
38
38
|
end
|
39
39
|
|
40
40
|
def check_abbreviation(abbreviation)
|
41
41
|
return if abbreviation.nil? || DOCTYPES.key?(abbreviation)
|
42
42
|
|
43
|
-
Util.warn "
|
43
|
+
Util.warn "invalid doctype abbreviation: `#{abbreviation}`"
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -3,6 +3,15 @@ module RelatonEtsi
|
|
3
3
|
include RelatonBib::HashConverter
|
4
4
|
extend self
|
5
5
|
|
6
|
+
def hash_to_bib(hash) # rubocop:disable Metrics/AbcSize
|
7
|
+
ret = super
|
8
|
+
ret[:marker] = hash["ext"]["marker"] if hash.dig("ext", "marker")
|
9
|
+
ret[:frequency] = hash["ext"]["frequency"] if hash.dig("ext", "frequency")
|
10
|
+
ret[:mandate] = hash["ext"]["mandate"] if hash.dig("ext", "mandate")
|
11
|
+
ret[:custom_collection] = hash["ext"]["custom_collection"] if hash.dig("ext", "custom_collection")
|
12
|
+
ret
|
13
|
+
end
|
14
|
+
|
6
15
|
private
|
7
16
|
|
8
17
|
# @param item_hash [Hash]
|
@@ -10,5 +19,9 @@ module RelatonEtsi
|
|
10
19
|
def bib_item(item_hash)
|
11
20
|
BibliographicItem.new(**item_hash)
|
12
21
|
end
|
22
|
+
|
23
|
+
def create_doctype(**args)
|
24
|
+
DocumentType.new(**args)
|
25
|
+
end
|
13
26
|
end
|
14
27
|
end
|
data/lib/relaton_etsi/util.rb
CHANGED
data/lib/relaton_etsi/version.rb
CHANGED
@@ -23,6 +23,10 @@ module RelatonEtsi
|
|
23
23
|
BibliographicItem.new(**item_hash)
|
24
24
|
end
|
25
25
|
|
26
|
+
def create_doctype(type)
|
27
|
+
DocumentType.new type: type.text, abbreviation: type[:abbreviation]
|
28
|
+
end
|
29
|
+
|
26
30
|
# def fetch_status(item)
|
27
31
|
# status = item.at "./status"
|
28
32
|
# return unless status
|
data/lib/relaton_etsi.rb
CHANGED
@@ -6,7 +6,6 @@ require "csv"
|
|
6
6
|
require "relaton/index"
|
7
7
|
require "relaton_bib"
|
8
8
|
require_relative "relaton_etsi/version"
|
9
|
-
require_relative "relaton_etsi/config"
|
10
9
|
require_relative "relaton_etsi/util"
|
11
10
|
require_relative "relaton_etsi/pubid"
|
12
11
|
require_relative "relaton_etsi/document_type"
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-etsi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: csv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: relaton-bib
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
16
30
|
requirements:
|
17
31
|
- - "~>"
|
18
32
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
33
|
+
version: 1.20.0
|
20
34
|
type: :runtime
|
21
35
|
prerelease: false
|
22
36
|
version_requirements: !ruby/object:Gem::Requirement
|
23
37
|
requirements:
|
24
38
|
- - "~>"
|
25
39
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
40
|
+
version: 1.20.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: relaton-index
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +73,6 @@ files:
|
|
59
73
|
- lib/relaton_etsi.rb
|
60
74
|
- lib/relaton_etsi/bibliographic_item.rb
|
61
75
|
- lib/relaton_etsi/bibliography.rb
|
62
|
-
- lib/relaton_etsi/config.rb
|
63
76
|
- lib/relaton_etsi/data_fetcher.rb
|
64
77
|
- lib/relaton_etsi/data_parser.rb
|
65
78
|
- lib/relaton_etsi/document_type.rb
|
@@ -75,7 +88,7 @@ licenses:
|
|
75
88
|
- BSD-2-Clause
|
76
89
|
metadata:
|
77
90
|
homepage_uri: https://github.com/relaton/relaton-etsi
|
78
|
-
post_install_message:
|
91
|
+
post_install_message:
|
79
92
|
rdoc_options: []
|
80
93
|
require_paths:
|
81
94
|
- lib
|
@@ -90,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
103
|
- !ruby/object:Gem::Version
|
91
104
|
version: '0'
|
92
105
|
requirements: []
|
93
|
-
rubygems_version: 3.3.
|
94
|
-
signing_key:
|
106
|
+
rubygems_version: 3.3.27
|
107
|
+
signing_key:
|
95
108
|
specification_version: 4
|
96
109
|
summary: 'RelatonEtsi: retrieve ETSI Standards for bibliographic using the BibliographicItem
|
97
110
|
model'
|