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 +4 -4
- data/README.adoc +5 -12
- data/grammars/basicdoc.rng +3 -0
- data/lib/relaton_bsi/bsi_bibliographic_item.rb +1 -1
- data/lib/relaton_bsi/bsi_bibliography.rb +5 -5
- data/lib/relaton_bsi/document_type.rb +1 -1
- data/lib/relaton_bsi/util.rb +1 -4
- data/lib/relaton_bsi/version.rb +1 -1
- data/lib/relaton_bsi/xml_parser.rb +4 -0
- data/lib/relaton_bsi.rb +9 -10
- data/relaton_bsi.gemspec +1 -1
- metadata +4 -5
- data/lib/relaton_bsi/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: 99af92172169b8df75ed0eaa5a5b3e458915b4748384c5b079ce545bb537d1e7
|
4
|
+
data.tar.gz: a5229c520d69cabbcf2edc9ae1ff19fa920ac463bb0a87f9d5474a61fb5e8110
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
===
|
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.
|
data/grammars/basicdoc.rng
CHANGED
@@ -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 "
|
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.
|
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.
|
85
|
+
Util.info "Fetching from shop.bsigroup.com ...", key: code
|
86
86
|
unless cp
|
87
|
-
Util.
|
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.
|
118
|
+
Util.info "Found: `#{ret[:ret].docidentifier.first&.id}`", key: code
|
119
119
|
ret[:ret]
|
120
120
|
else
|
121
|
-
Util.
|
121
|
+
Util.info "No found", key: code
|
122
122
|
fetch_ref_err(code, year, ret[:years])
|
123
123
|
end
|
124
124
|
end
|
data/lib/relaton_bsi/util.rb
CHANGED
data/lib/relaton_bsi/version.rb
CHANGED
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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.
|
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.
|
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-
|
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.
|
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.
|
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
|