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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd8b1afecd70ee7ac07ba4b734af8b0b9ade5998348866f82876b06bfd7be068
4
- data.tar.gz: cd83c99606d209824fffaa12ea2133eccf6c0b73a92d010d30e9353307d63303
3
+ metadata.gz: 81c7a95a6b38369cc2700680b2c39f3d8d75fff3761123e4fb87565a2f04dc2d
4
+ data.tar.gz: 29d1ac8bd79de191815a29a055189d05de180f964f095f3f6bdd5f77721ed892
5
5
  SHA512:
6
- metadata.gz: 5ca5594263e19b6fa91fb59d5f1c5a55cbd24c59bc45de30761e644c26859cce4da0bdebf3e5d5330fa6d83696b5a3843aca401b4c46ea3618892c81576a5eee
7
- data.tar.gz: 8f5633242ded91de51eb65c456e7ddd9286159cef042043d29dd1abc1452ccab42736911cf6fc52f00cdfb5a969a9e1b426922f41486eb2112d344816966ed39
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
- === 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.
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.
@@ -244,6 +244,9 @@
244
244
  <data type="ID"/>
245
245
  </attribute>
246
246
  <attribute name="reviewer"/>
247
+ <optional>
248
+ <attribute name="type"/>
249
+ </optional>
247
250
  <optional>
248
251
  <attribute name="date">
249
252
  <data type="dateTime"/>
@@ -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.warn "(#{ref}) Fetching from Relaton repository ..."
35
+ Util.info "Fetching from Relaton repository ...", key: ref
36
36
  result = search(ref)
37
37
  unless result
38
- Util.warn "(#{ref}) Not found."
38
+ Util.info "Not found.", key: ref
39
39
  return
40
40
  end
41
41
 
42
- Util.warn "(#{ref}) Found: `#{result.docidentifier[0].id}`"
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 "WARNING: invalid doctype: `#{type}`"
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 "WARNING: invalid doctype abbreviation: `#{abbreviation}`"
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
@@ -1,9 +1,6 @@
1
1
  module RelatonEtsi
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonEtsi.configuration.logger
7
- end
4
+ PROGNAME = "relaton-etsi".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonEtsi
4
- VERSION = "1.18.0"
4
+ VERSION = "1.20.0"
5
5
  end
@@ -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.18.0
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-01-06 00:00:00.000000000 Z
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.18.0
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.18.0
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.26
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'
@@ -1,10 +0,0 @@
1
- module RelatonEtsi
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-etsi".freeze
9
- end
10
- end