relaton-ogc 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 +14 -3
- data/lib/relaton_ogc/data_fetcher.rb +1 -1
- data/lib/relaton_ogc/ogc_bibliographic_item.rb +1 -2
- data/lib/relaton_ogc/ogc_bibliography.rb +6 -7
- data/lib/relaton_ogc/scrapper.rb +1 -0
- data/lib/relaton_ogc/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: 94c067f788bc30304bea9b3889f0eeff0e6e87fc5889b4ed0cd0eadf9cf8a832
|
4
|
+
data.tar.gz: 72f53392fb689985074830f951af82c2860e3d8ef8e69f7392c15ea360628cd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6809fb1fc685773538971a94fe6f232c7468ef2c6474c3889b6f9107b917c9f0d3e9eeca87dfc15971ba1c60954e44a3572424416e514133e2430d9ed49e13c8
|
7
|
+
data.tar.gz: 03d0cb7c9325f5ef1d12baf1dd64b23012d1202ca7a20ff257d94a6411cd130f42423fe3125d4f92371adcdffbe1f6113e5c2c1f677389575c7b4c6fdb23d961
|
data/README.adoc
CHANGED
@@ -31,13 +31,24 @@ Or install it yourself as:
|
|
31
31
|
|
32
32
|
== Usage
|
33
33
|
|
34
|
-
===
|
34
|
+
=== Configuration
|
35
|
+
|
36
|
+
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 `RelatonOgc.configure` block.
|
35
37
|
|
36
38
|
[source,ruby]
|
37
39
|
----
|
38
40
|
require 'relaton_ogc'
|
39
41
|
=> true
|
40
42
|
|
43
|
+
RelatonOgc.configure do |config|
|
44
|
+
config.logger.level = Logger::DEBUG
|
45
|
+
end
|
46
|
+
----
|
47
|
+
|
48
|
+
=== Search for a standard using keywords
|
49
|
+
|
50
|
+
[source,ruby]
|
51
|
+
----
|
41
52
|
hits = RelatonOgc::OgcBibliography.search("OGC 19-025r1")
|
42
53
|
=> <RelatonOgc::HitCollection:0x007fcc8e085ba8 @ref=OGC 19-025r1 @fetched=true>
|
43
54
|
|
@@ -83,8 +94,8 @@ item.to_xml bibdata: true
|
|
83
94
|
[source,ruby]
|
84
95
|
----
|
85
96
|
RelatonOgc::OgcBibliography.get "OGC 19-025r1", "2019", {}
|
86
|
-
[relaton-ogc] (
|
87
|
-
[relaton-ogc] (
|
97
|
+
[relaton-ogc] (OGC 19-025r1) Fetching from Relaton repository ...
|
98
|
+
[relaton-ogc] (OGC 19-025r1) Found: `19-025r1`
|
88
99
|
=> #<RelatonOgc::OgcBibliographicItem:0x007fc322e9aba0
|
89
100
|
...
|
90
101
|
----
|
@@ -72,7 +72,7 @@ module RelatonOgc
|
|
72
72
|
get_data do |etag, json|
|
73
73
|
no_errors = true
|
74
74
|
json.each { |_, hit| fetch_doc(hit) || no_errors = false }
|
75
|
-
warn "
|
75
|
+
warn "WARNING Duplicated documents: #{@dupids.to_a.join(', ')}" if @dupids.any?
|
76
76
|
self.etag = etag if no_errors
|
77
77
|
index.save
|
78
78
|
end
|
@@ -16,8 +16,7 @@ module RelatonOgc
|
|
16
16
|
|
17
17
|
def initialize(**args)
|
18
18
|
if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype])
|
19
|
-
warn "
|
20
|
-
"subtype: #{args[:subdoctype]}"
|
19
|
+
Util.warn "WARNING: Invalid document subtype: `#{args[:subdoctype]}`"
|
21
20
|
end
|
22
21
|
|
23
22
|
# @docsubtype = args.delete :docsubtype
|
@@ -20,10 +20,11 @@ module RelatonOgc
|
|
20
20
|
#
|
21
21
|
# @return [String] Relaton XML serialisation of reference
|
22
22
|
def get(code, year = nil, opts = {})
|
23
|
+
# id = year ? "`#{code}` year `#{year}`" : "#`{code}`"
|
23
24
|
result = bib_search_filter(code, year, opts) || (return nil)
|
24
25
|
ret = bib_results_filter(result, year)
|
25
26
|
if ret[:ret]
|
26
|
-
warn "
|
27
|
+
Util.warn "(#{code}) Found: `#{ret[:ret].docidentifier.first.id}`"
|
27
28
|
ret[:ret]
|
28
29
|
else
|
29
30
|
fetch_ref_err(code, year, ret[:years])
|
@@ -33,7 +34,7 @@ module RelatonOgc
|
|
33
34
|
private
|
34
35
|
|
35
36
|
def bib_search_filter(code, year, opts)
|
36
|
-
warn "
|
37
|
+
Util.warn "(#{code}) Fetching from Relaton repository ..."
|
37
38
|
search(code, year, opts)
|
38
39
|
end
|
39
40
|
|
@@ -67,12 +68,10 @@ module RelatonOgc
|
|
67
68
|
# @param year [String]
|
68
69
|
# @param missed_years [Array<Strig>]
|
69
70
|
def fetch_ref_err(code, year, missed_years)
|
70
|
-
|
71
|
-
warn "[relaton-ogc] WARNING: no match found online for #{id}. " \
|
72
|
-
"The code must be exactly like it is on the standards website."
|
71
|
+
Util.warn "(#{code}) Not found."
|
73
72
|
unless missed_years.empty?
|
74
|
-
warn "
|
75
|
-
|
73
|
+
Util.warn "There was no match for `#{year}`, though there " \
|
74
|
+
"were matches found for `#{missed_years.join('`, `')}`."
|
76
75
|
end
|
77
76
|
nil
|
78
77
|
end
|
data/lib/relaton_ogc/scrapper.rb
CHANGED
data/lib/relaton_ogc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ogc
|
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-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|