relaton-cen 1.16.1 → 1.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +30 -8
- data/lib/relaton_cen/cen_bibliography.rb +11 -7
- data/lib/relaton_cen/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: 2248f1f7fe9dd799b39377fdfd075fda4dc79ef9389a05e398a8f514c639619d
|
|
4
|
+
data.tar.gz: 7b88f2fbcc7d1041659dfe82f0344159734a014cb982bfeb046bcb3b55be5d45
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f3725d5b38db4229ec1c84a2a4033ef62a1c506cb07bec2f4059620ca74135fc1f58011017b4d7424ebae35c5a027cf3ef2ccb6ad1f276645aa35d434102985
|
|
7
|
+
data.tar.gz: e4cd2809857e01da01a4f5ff703ea1aeb215e3d3a5396564883df0001c2f5e37c78606c4c837824a4aab13999f757bc831c2d063dfe81add6e957d9fcd1d45b6
|
data/README.adoc
CHANGED
|
@@ -52,18 +52,40 @@ item = hit_collection[0].fetch
|
|
|
52
52
|
|
|
53
53
|
=== Get a standard by its code
|
|
54
54
|
|
|
55
|
+
Use `RelatonCen::CenBibliography.get(ref, year, options)` to get a standard by its code.
|
|
56
|
+
|
|
57
|
+
- `ref` is the standard code, e.g. `CEN ISO/TS 21003-7`
|
|
58
|
+
- `year` is the year of the standard, e.g. `2019` (optional)
|
|
59
|
+
- `options` is a hash of options:
|
|
60
|
+
- `keep_year` - keep the year in ID if true (optional)
|
|
61
|
+
|
|
55
62
|
[source,ruby]
|
|
56
63
|
----
|
|
64
|
+
# With year in reference
|
|
65
|
+
RelatonCen::CenBibliography.get "EN 10160:1999"
|
|
66
|
+
[relaton-cen] (EN 10160:1999) fetching...
|
|
67
|
+
[relaton-cen] (EN 10160:1999) found `EN 10160:1999`
|
|
68
|
+
=> #<RelatonCen::BibliographicItem:0x0000000112d8b900
|
|
69
|
+
...
|
|
70
|
+
|
|
71
|
+
# With a year as a separate argument
|
|
72
|
+
RelatonCen::CenBibliography.get "EN 10160", "1999"
|
|
73
|
+
|
|
74
|
+
# To get the most recent version of a standard by its code use reference without year
|
|
57
75
|
> RelatonCen::CenBibliography.get "CEN/CLC Guide 6"
|
|
58
76
|
[relaton-cen] (CEN/CLC Guide 6) fetching...
|
|
59
|
-
[isoics] code
|
|
60
|
-
[relaton-cen] (CEN/CLC Guide 6)
|
|
61
|
-
=>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
[isoics] code not found in ICS list
|
|
78
|
+
[relaton-cen] (CEN/CLC Guide 6) found `CEN/CLC Guide 6`
|
|
79
|
+
=> #<RelatonCen::BibliographicItem:0x0000000112d81680
|
|
80
|
+
...
|
|
81
|
+
|
|
82
|
+
# To keep the year in ID use `keep_year` option
|
|
83
|
+
> RelatonCen::CenBibliography.get "CEN/CLC Guide 6", nil, keep_year: true
|
|
84
|
+
[relaton-cen] (CEN/CLC Guide 6) fetching...
|
|
85
|
+
[isoics] code not found in ICS list
|
|
86
|
+
[relaton-cen] (CEN/CLC Guide 6) found `CEN/CLC Guide 6:2014`
|
|
87
|
+
=> #<RelatonCen::BibliographicItem:0x0000000112d8b400
|
|
88
|
+
...
|
|
67
89
|
----
|
|
68
90
|
|
|
69
91
|
=== XML serialization
|
|
@@ -13,11 +13,14 @@ module RelatonCen
|
|
|
13
13
|
raise RelatonBib::RequestError, e.message
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
+
#
|
|
16
17
|
# @param code [String] the CEN standard Code to look up
|
|
17
18
|
# @param year [String] the year the standard was published (optional)
|
|
18
|
-
# @param opts [Hash] options
|
|
19
|
-
#
|
|
19
|
+
# @param opts [Hash] options
|
|
20
|
+
# @option opts [Boolean] :keep_year don't upate reference
|
|
21
|
+
#
|
|
20
22
|
# @return [RelatonBib::BibliographicItem, nil]
|
|
23
|
+
#
|
|
21
24
|
def get(code, year = nil, opts = {})
|
|
22
25
|
code_parts = code_to_parts code
|
|
23
26
|
year ||= code_parts[:year] if code_parts
|
|
@@ -64,9 +67,8 @@ module RelatonCen
|
|
|
64
67
|
|
|
65
68
|
# @param code [String]
|
|
66
69
|
# @return [RelatonCen::HitCollection]
|
|
67
|
-
def search_filter(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/
|
|
70
|
+
def search_filter(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
68
71
|
parts = code_to_parts code
|
|
69
|
-
warn "[relaton-cen] (\"#{code}\") fetching..."
|
|
70
72
|
result = search(code)
|
|
71
73
|
result.select do |i|
|
|
72
74
|
pts = code_to_parts i.hit[:code]
|
|
@@ -97,12 +99,14 @@ module RelatonCen
|
|
|
97
99
|
{ years: missed_years }
|
|
98
100
|
end
|
|
99
101
|
|
|
100
|
-
def bib_get(code, year,
|
|
102
|
+
def bib_get(code, year, opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
|
|
103
|
+
ref = year.nil? || code.match?(/:\d{4}/) ? code : "#{code}:#{year}"
|
|
104
|
+
warn "[relaton-cen] (#{ref}) fetching..."
|
|
101
105
|
result = search_filter(code) || return
|
|
102
106
|
ret = isobib_results_filter(result, year)
|
|
103
107
|
if ret[:ret]
|
|
104
|
-
bib = year ? ret[:ret] : ret[:ret].to_most_recent_reference
|
|
105
|
-
warn "[relaton-cen] (#{
|
|
108
|
+
bib = year || opts[:keep_year] ? ret[:ret] : ret[:ret].to_most_recent_reference
|
|
109
|
+
warn "[relaton-cen] (#{ref}) found `#{bib.docidentifier.first&.id}`"
|
|
106
110
|
bib
|
|
107
111
|
else
|
|
108
112
|
fetch_ref_err(code, year, ret[:years])
|
data/lib/relaton_cen/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-cen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.16.
|
|
4
|
+
version: 1.16.2
|
|
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-09-
|
|
11
|
+
date: 2023-09-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mechanize
|