relaton-bsi 1.18.1 → 1.19.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: b4c523e402c6e17583164c104864771561c0fa5fa4031f7db2213d38ab4e2db4
4
- data.tar.gz: e8361d2ec9755703179ddfb12719c81d18e2dd1818496c80c637ea9e2bfd1317
3
+ metadata.gz: 99af92172169b8df75ed0eaa5a5b3e458915b4748384c5b079ce545bb537d1e7
4
+ data.tar.gz: a5229c520d69cabbcf2edc9ae1ff19fa920ac463bb0a87f9d5474a61fb5e8110
5
5
  SHA512:
6
- metadata.gz: 502077f0182a1bef51e2fddae6ba0489a8dea264d3e1e91615c87a52c8e60fe3b1cb16a4cf92b0e3a3f85d05c2eef059cf9a81d4d05596b08a87e550e806d6ae
7
- data.tar.gz: 8e48df93646e97ba217a5bf84bf6b926de6ac6c3497180d017730d39472300cef13f228dbbc5aa06405744b734a013b164d391e9585651c54f940a04971e232d
6
+ metadata.gz: 1622681a2c14d77bb235eb01a57b14dfda1772ebbf18ea72d5224878a57ca330eec65c6ec4955a932e8e9b3de0857856b56868c1257cdae0cdff178188045503
7
+ data.tar.gz: f209f6be6baeff12865568275634f251023d2b0cba6deac3d6743ef8545e0911db6d4677003bac1ec52fb2df6426ed1a890eea00e1429b42db986b7161208d7f
data/README.adoc CHANGED
@@ -27,24 +27,13 @@ Or install it yourself as:
27
27
 
28
28
  == Usage
29
29
 
30
- === Configuration
31
-
32
- 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 `RelatonBsi.configure` block.
30
+ === Search for a standard using keywords
33
31
 
34
32
  [source,ruby]
35
33
  ----
36
34
  require 'relaton_bsi'
37
35
  => true
38
36
 
39
- RelatonBsi.configure do |config|
40
- config.logger.level = Logger::DEBUG
41
- end
42
- ----
43
-
44
- === Search for a standard using keywords
45
-
46
- [source,ruby]
47
- ----
48
37
  hit_collection = RelatonBsi::BsiBibliography.search("BS EN ISO 8848")
49
38
  => <RelatonBsi::HitCollection:0x007fead49fe1f8 @ref=BS EN ISO 8848 @fetched=false>
50
39
 
@@ -132,6 +121,10 @@ RelatonBsi::XMLParser.from_xml File.read("spec/fixtures/bibdata.xml", encoding:
132
121
  ...
133
122
  ----
134
123
 
124
+ === Logging
125
+
126
+ RelatonBsi 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.
127
+
135
128
  == Development
136
129
 
137
130
  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"/>
@@ -4,7 +4,7 @@ module RelatonBsi
4
4
 
5
5
  def initialize(**args) # rubocop:disable Metrics/AbcSize
6
6
  if args[:subdoctype] && !SUBDOCTYPES.include?(args[:subdoctype])
7
- Util.warn "WARNING: invalid subdoctype: `#{args[:subdoctype]}`"
7
+ Util.warn "invalid subdoctype: `#{args[:subdoctype]}`"
8
8
  Util.warn "Allowed subdoctypes are: `#{SUBDOCTYPES.join('`, `')}`"
9
9
  end
10
10
  super
@@ -58,7 +58,7 @@ module RelatonBsi
58
58
  # Util.warn "WARNING: no match found online for `#{id}`. " \
59
59
  # "The code must be exactly like it is on the standards website."
60
60
  unless missed_years.empty?
61
- Util.warn "There was no match for `#{year}`, though there " \
61
+ Util.info "There was no match for `#{year}`, though there " \
62
62
  "were matches found for `#{missed_years.join('`, `')}`."
63
63
  end
64
64
  # if /\d-\d/.match? code
@@ -82,9 +82,9 @@ module RelatonBsi
82
82
  #
83
83
  def search_filter(code)
84
84
  cp = code_parts code
85
- Util.warn "(#{code}) Fetching from shop.bsigroup.com ..."
85
+ Util.info "Fetching from shop.bsigroup.com ...", key: code
86
86
  unless cp
87
- Util.warn "(#{code}) Could not parse the reference"
87
+ Util.info "Could not parse the reference", key: code
88
88
  return []
89
89
  end
90
90
 
@@ -115,10 +115,10 @@ module RelatonBsi
115
115
  result = search_filter(code) || return
116
116
  ret = results_filter(result, year)
117
117
  if ret[:ret]
118
- Util.warn "(#{code}) Found: `#{ret[:ret].docidentifier.first&.id}`"
118
+ Util.info "Found: `#{ret[:ret].docidentifier.first&.id}`", key: code
119
119
  ret[:ret]
120
120
  else
121
- Util.warn "(#{code}) No found"
121
+ Util.info "No found", key: code
122
122
  fetch_ref_err(code, year, ret[:years])
123
123
  end
124
124
  end
@@ -14,7 +14,7 @@ module RelatonBsi
14
14
 
15
15
  def check_type(type)
16
16
  unless DOCTYPES.include? type
17
- Util.warn "WARNING: invalid doctype: `#{type}`"
17
+ Util.warn "invalid doctype: `#{type}`"
18
18
  end
19
19
  end
20
20
  end
@@ -1,9 +1,6 @@
1
1
  module RelatonBsi
2
2
  module Util
3
3
  extend RelatonBib::Util
4
-
5
- def self.logger
6
- RelatonBsi.configuration.logger
7
- end
4
+ PROGNAME = "relaton-bsi".freeze
8
5
  end
9
6
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonBsi
4
- VERSION = "1.18.1"
4
+ VERSION = "1.19.0"
5
5
  end
@@ -21,6 +21,10 @@ module RelatonBsi
21
21
  def bib_item(item_hash)
22
22
  BsiBibliographicItem.new(**item_hash)
23
23
  end
24
+
25
+ def create_doctype(type)
26
+ DocumentType.new type: type.text, abbreviation: type[:abbreviation]
27
+ end
24
28
  end
25
29
  end
26
30
  end
data/lib/relaton_bsi.rb CHANGED
@@ -2,16 +2,15 @@
2
2
 
3
3
  require "relaton_iso_bib"
4
4
  require_relative "relaton_bsi/version"
5
- require "relaton_bsi/config"
6
- require "relaton_bsi/util"
7
- require "relaton_bsi/document_type"
8
- require "relaton_bsi/bsi_bibliography"
9
- require "relaton_bsi/bsi_bibliographic_item"
10
- require "relaton_bsi/scrapper"
11
- require "relaton_bsi/hit_collection"
12
- require "relaton_bsi/hit"
13
- require "relaton_bsi/xml_parser"
14
- require "relaton_bsi/hash_converter"
5
+ require_relative "relaton_bsi/util"
6
+ require_relative "relaton_bsi/document_type"
7
+ require_relative "relaton_bsi/bsi_bibliography"
8
+ require_relative "relaton_bsi/bsi_bibliographic_item"
9
+ require_relative "relaton_bsi/scrapper"
10
+ require_relative "relaton_bsi/hit_collection"
11
+ require_relative "relaton_bsi/hit"
12
+ require_relative "relaton_bsi/xml_parser"
13
+ require_relative "relaton_bsi/hash_converter"
15
14
 
16
15
  module RelatonBsi
17
16
  # Returns hash of XML greammar
data/relaton_bsi.gemspec CHANGED
@@ -33,5 +33,5 @@ Gem::Specification.new do |spec|
33
33
  spec.add_dependency "faraday-net_http_persistent", "~> 2.0"
34
34
  spec.add_dependency "graphql", "1.13.6"
35
35
  spec.add_dependency "graphql-client", "~> 0.16.0"
36
- spec.add_dependency "relaton-iso-bib", "~> 1.18.0"
36
+ spec.add_dependency "relaton-iso-bib", "~> 1.19.0"
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bsi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.1
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-20 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: algolia
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.18.0
75
+ version: 1.19.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.18.0
82
+ version: 1.19.0
83
83
  description: 'RelatonBsi: retrieve BSI Standards for bibliographic use using the BibliographicItem
84
84
  model'
85
85
  email:
@@ -108,7 +108,6 @@ files:
108
108
  - lib/relaton_bsi.rb
109
109
  - lib/relaton_bsi/bsi_bibliographic_item.rb
110
110
  - lib/relaton_bsi/bsi_bibliography.rb
111
- - lib/relaton_bsi/config.rb
112
111
  - lib/relaton_bsi/document_type.rb
113
112
  - lib/relaton_bsi/hash_converter.rb
114
113
  - lib/relaton_bsi/hit.rb
@@ -1,10 +0,0 @@
1
- module RelatonBsi
2
- module Config
3
- include RelatonBib::Config
4
- end
5
- extend Config
6
-
7
- class Configuration < RelatonBib::Configuration
8
- PROGNAME = "relaton-bsi".freeze
9
- end
10
- end