relaton-bipm 1.16.1 → 1.16.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +32 -29
- data/lib/relaton_bipm/bipm_bibliographic_item.rb +2 -2
- data/lib/relaton_bipm/bipm_bibliography.rb +24 -22
- data/lib/relaton_bipm/committee.rb +1 -1
- data/lib/relaton_bipm/id_parser.rb +1 -1
- data/lib/relaton_bipm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d8e6a865105cdcf8855183ef3e9a643f7b5927a45e7fb323933b35e6c785c5b
|
4
|
+
data.tar.gz: 7d0e021593a5b8e0da95ff90aaf7f62a769d2d96bff362779025b01cfc6f950a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87020ee215e5bdd22faef4628a2dee2745e18a946da0fed498e374d1acc80bede9a4e3ea21afee2fd9375a0ef29ece739f5466cd45a32e73d991eead21272232
|
7
|
+
data.tar.gz: 0a009e46923cbfb67361f2edb48198a1a1f82022c4925fa3780bb5d6137ca3585fcf5de376aca5f743db11855db034a68acdc56b72f921351a9d2ebe7a4ce03c
|
data/README.adoc
CHANGED
@@ -33,14 +33,6 @@ Or install it yourself as:
|
|
33
33
|
|
34
34
|
=== Search for a standard using keywords
|
35
35
|
|
36
|
-
The Metrologia website employs anti-DDoS protection, which may cause the search to fail. If this happens, open provided link in a browser and solve the captcha.
|
37
|
-
|
38
|
-
----
|
39
|
-
[relaton-bipm] ("BIPM Metrologia 50 4 385") fetching...
|
40
|
-
[relaton-bipm] This source employs anti-DDoS measures that unfortunately affect automated requests.
|
41
|
-
[relaton-bipm] Please visit this link in your browser to resolve the CAPTCHA, then retry: https://iopscience.iop.org/article/10.1088/0026-1394/50/4/385
|
42
|
-
----
|
43
|
-
|
44
36
|
==== References for Si-Brochure documents
|
45
37
|
|
46
38
|
`BIPM {DOCUMENT_NAME}`
|
@@ -187,76 +179,87 @@ Recommendation JCRB/43-1 (2021) / Recommandation JCRB/43-1 (2021)
|
|
187
179
|
JCRB REC JCRB/43-1 (2021)
|
188
180
|
----
|
189
181
|
|
190
|
-
|
182
|
+
=== Configuration
|
183
|
+
|
184
|
+
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 `RelatonBipm.configure` block.
|
191
185
|
|
192
186
|
[source,ruby]
|
193
187
|
----
|
194
188
|
require 'relaton_bipm'
|
195
189
|
=> true
|
196
190
|
|
191
|
+
RelatonBipm.configure do |config|
|
192
|
+
config.logger.level = Logger::DEBUG
|
193
|
+
end
|
194
|
+
----
|
195
|
+
|
196
|
+
==== Examples
|
197
|
+
|
198
|
+
[source,ruby]
|
199
|
+
----
|
197
200
|
# get BIPM brochure
|
198
201
|
item = RelatonBipm::BipmBibliography.get "BIPM SI Brochure"
|
199
|
-
[relaton-bipm] (
|
200
|
-
[relaton-bipm] (
|
202
|
+
[relaton-bipm] (BIPM SI Brochure) Fetching from Relaton repository ...
|
203
|
+
[relaton-bipm] (BIPM SI Brochure) Found: `BIPM SI Brochure`
|
201
204
|
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb83982fe8
|
202
205
|
...
|
203
206
|
|
204
207
|
# get BIPM Metrologia page
|
205
208
|
bib = RelatonBipm::BipmBibliography.get "BIPM Metrologia 29 6 001"
|
206
|
-
[relaton-bipm] (
|
207
|
-
[relaton-bipm] (
|
209
|
+
[relaton-bipm] (BIPM Metrologia 29 6 001) Fetching from Relaton repository ...
|
210
|
+
[relaton-bipm] (BIPM Metrologia 29 6 001) Found: `Metrologia 29 6 001`
|
208
211
|
=> #<RelatonBipm::BipmBibliographicItem:0x007f8857f94d40
|
209
212
|
...
|
210
213
|
|
211
214
|
# get CGPM meetings
|
212
215
|
RelatonBipm::BipmBibliography.get "CGPM 1st Meeting (1889)"
|
213
|
-
[relaton-bipm] (
|
214
|
-
[relaton-bipm] (
|
216
|
+
[relaton-bipm] (CGPM 1st Meeting (1889)) Fetching from Relaton repository ...
|
217
|
+
[relaton-bipm] (CGPM 1st Meeting (1889)) Found: `CGPM 1th meeting (1889)`
|
215
218
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f7fd02aba28
|
216
219
|
...
|
217
220
|
|
218
221
|
# get CGPM resolutions
|
219
222
|
RelatonBipm::BipmBibliography.get "CGPM RES (1889, E)"
|
220
|
-
[relaton-bipm] (
|
221
|
-
[relaton-bipm] (
|
223
|
+
[relaton-bipm] (CGPM RES (1889, E)) Fetching from Relaton repository ...
|
224
|
+
[relaton-bipm] (CGPM RES (1889, E)) Found: `CGPM RES (1889)`
|
222
225
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f80421f93d8
|
223
226
|
...
|
224
227
|
|
225
228
|
RelatonBipm::BipmBibliography.get "CGPM Resolution (1889)"
|
226
|
-
[relaton-bipm] (
|
227
|
-
[relaton-bipm] (
|
229
|
+
[relaton-bipm] (CGPM Resolution (1889)) Fetching from Relaton repository ...
|
230
|
+
[relaton-bipm] (CGPM Resolution (1889)) Found: `CGPM RES (1889)`
|
228
231
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f60c18
|
229
232
|
...
|
230
233
|
|
231
234
|
RelatonBipm::BipmBibliography.get "CGPM Résolution (1889)"
|
232
|
-
[relaton-bipm] (
|
233
|
-
[relaton-bipm] (
|
235
|
+
[relaton-bipm] (CGPM Résolution (1889)) Fetching from Relaton repository ...
|
236
|
+
[relaton-bipm] (CGPM Résolution (1889)) Found: `CGPM RES (1889)`
|
234
237
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f492e8
|
235
238
|
...
|
236
239
|
|
237
240
|
# get CIPM decision by year and decision number
|
238
241
|
RelatonBipm::BipmBibliography.get "BIPM Decision CIPM/101-1 (2012)"
|
239
|
-
[relaton-bipm] (
|
240
|
-
[relaton-bipm] (
|
242
|
+
[relaton-bipm] (BIPM Decision CIPM/101-1 (2012)) Fetching from Relaton repository ...
|
243
|
+
[relaton-bipm] (BIPM Decision CIPM/101-1 (2012)) Found: `CIPM DECN 101-1 (2012)`
|
241
244
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f2bd88
|
242
245
|
...
|
243
246
|
|
244
247
|
RelatonBipm::BipmBibliography.get "BIPM DECN CIPM/101-1 (2012, E)"
|
245
|
-
[relaton-bipm] (
|
246
|
-
[relaton-bipm] (
|
248
|
+
[relaton-bipm] (BIPM DECN CIPM/101-1 (2012, E)) Fetching from Relaton repository ...
|
249
|
+
[relaton-bipm] (BIPM DECN CIPM/101-1 (2012, E)) Found: `CIPM DECN 101-1 (2012)`
|
247
250
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f39438
|
248
251
|
...
|
249
252
|
|
250
253
|
# get CIPM recommendation
|
251
254
|
RelatonBipm::BipmBibliography.get "CIPM Recommendation 1 (2005)"
|
252
|
-
[relaton-bipm] (
|
253
|
-
[relaton-bipm] (
|
255
|
+
[relaton-bipm] (CIPM Recommendation 1 (2005)) Fetching from Relaton repository ...
|
256
|
+
[relaton-bipm] (CIPM Recommendation 1 (2005)) Found: `CIPM REC 1 (2005)`
|
254
257
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f31da0
|
255
258
|
...
|
256
259
|
|
257
260
|
RelatonBipm::BipmBibliography.get "CIPM REC 1 (2005, FR)"
|
258
|
-
[relaton-bipm] (
|
259
|
-
[relaton-bipm] (
|
261
|
+
[relaton-bipm] (CIPM REC 1 (2005, FR)) Fetching from Relaton repository ...
|
262
|
+
[relaton-bipm] (CIPM REC 1 (2005, FR)) Found: `CIPM REC 1 (2005)`
|
260
263
|
=> #<RelatonBipm::BipmBibliographicItem:0x00007f80422100d8
|
261
264
|
...
|
262
265
|
----
|
@@ -27,12 +27,12 @@ module RelatonBipm
|
|
27
27
|
# @param structuredidentifier [RelatonBipm::StructuredIdentifier]
|
28
28
|
def initialize(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
29
29
|
if args[:docstatus] && !STATUSES.include?(args[:docstatus].stage.value)
|
30
|
-
Util.warn "
|
30
|
+
Util.warn "WARNING: Invalid docstatus: `#{args[:docstatus].stage.value}`. " \
|
31
31
|
"It should be one of: `#{STATUSES.join('`, `')}`"
|
32
32
|
end
|
33
33
|
|
34
34
|
if args[:si_aspect] && !SI_ASPECTS.include?(args[:si_aspect])
|
35
|
-
Util.warn "
|
35
|
+
Util.warn "WARNING: Invalid si_aspect: `#{args[:si_aspect]}``. " \
|
36
36
|
"It should be one of: `#{SI_ASPECTS.join('`, `')}`"
|
37
37
|
end
|
38
38
|
|
@@ -9,47 +9,49 @@ module RelatonBipm
|
|
9
9
|
# @param text [String]
|
10
10
|
# @return [RelatonBipm::BipmBibliographicItem]
|
11
11
|
def search(text, _year = nil, _opts = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
12
|
-
Util.warn "(#{text})
|
12
|
+
Util.warn "(#{text}) Fetching from Relaton repository ..."
|
13
13
|
ref = text.sub(/^BIPM\s/, "")
|
14
|
-
item = get_bipm
|
14
|
+
item = get_bipm ref
|
15
15
|
unless item
|
16
|
-
Util.warn "(#{text})
|
16
|
+
Util.warn "(#{text}) Not found."
|
17
17
|
return
|
18
18
|
end
|
19
19
|
|
20
|
-
Util.warn("(#{text})
|
20
|
+
Util.warn("(#{text}) Found: `#{item.docidentifier[0].id}`")
|
21
21
|
item
|
22
22
|
rescue Mechanize::ResponseCodeError => e
|
23
23
|
raise RelatonBib::RequestError, e.message unless e.response_code == "404"
|
24
24
|
end
|
25
25
|
|
26
26
|
# @return [Mechanize]
|
27
|
-
def magent # rubocop:disable Metrics/MethodLength
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
27
|
+
# def magent # rubocop:disable Metrics/MethodLength
|
28
|
+
# a = Mechanize.new
|
29
|
+
# a.request_headers = {
|
30
|
+
# "Accept" => "text/html,application/xhtml+xml,application/xml;q=0.9," \
|
31
|
+
# "image/avif,image/webp,image/apng," \
|
32
|
+
# "*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
33
|
+
# "Accept-Encoding" => "gzip, deflate, br",
|
34
|
+
# "Accept-Language" => "en-US,en;q=0.9,ru-RU;q=0.8,ru;q=0.7",
|
35
|
+
# "Cache-Control" => "max-age=0",
|
36
|
+
# "Upgrade-Insecure-Requests" => "1",
|
37
|
+
# }
|
38
|
+
# a.user_agent_alias = Mechanize::AGENT_ALIASES.map(&:first).shuffle.first
|
39
|
+
# # a.user_agent_alias = "Mac Safari"
|
40
|
+
# a
|
41
|
+
# end
|
42
42
|
|
43
|
+
#
|
43
44
|
# @param reference [String]
|
44
|
-
#
|
45
|
+
#
|
45
46
|
# @return [RelatonBipm::BipmBibliographicItem]
|
46
|
-
|
47
|
+
#
|
48
|
+
def get_bipm(reference) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
47
49
|
ref_id = Id.new reference
|
48
50
|
rows = index.search { |r| ref_id == r[:id] }
|
49
51
|
return unless rows.any?
|
50
52
|
|
51
53
|
url = "#{GH_ENDPOINT}#{rows.first[:file]}"
|
52
|
-
resp =
|
54
|
+
resp = Mechanize.new.get url
|
53
55
|
return unless resp.code == "200"
|
54
56
|
|
55
57
|
yaml = RelatonBib.parse_yaml resp.body, [Date]
|
@@ -11,7 +11,7 @@ module RelatonBipm
|
|
11
11
|
def initialize(acronym:, content: nil)
|
12
12
|
acronyms = YAML.load_file File.join(__dir__, "acronyms.yaml")
|
13
13
|
unless acronyms[acronym]
|
14
|
-
Util.warn "WARNING:
|
14
|
+
Util.warn "WARNING: Invalid acronym: `#{acronym}`. Allowed " \
|
15
15
|
"values: `#{acronyms.map { |k, _v| k }.join '`, `'}`"
|
16
16
|
end
|
17
17
|
|
@@ -76,7 +76,7 @@ module RelatonBipm
|
|
76
76
|
def initialize(id)
|
77
77
|
@id = Parser.new.parse(id)
|
78
78
|
rescue Parslet::ParseFailed => e
|
79
|
-
Util.warn "Incorrect reference: `#{id}`"
|
79
|
+
Util.warn "WARNING: Incorrect reference: `#{id}`"
|
80
80
|
# warn "[relaton-bipm] #{e.parse_failure_cause.ascii_tree}"
|
81
81
|
raise RelatonBib::RequestError, e
|
82
82
|
end
|
data/lib/relaton_bipm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bipm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|