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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 152c757b6f64d56ff90726fea30e01bbbb3d9314e1d7a1227ef8eb37f60a62c9
4
- data.tar.gz: 7440398d287b9db7afc8a18f7ccb22eff2c4628ea947b2ae8e88a732c527a807
3
+ metadata.gz: 94c067f788bc30304bea9b3889f0eeff0e6e87fc5889b4ed0cd0eadf9cf8a832
4
+ data.tar.gz: 72f53392fb689985074830f951af82c2860e3d8ef8e69f7392c15ea360628cd9
5
5
  SHA512:
6
- metadata.gz: cdae3988f8c6baf95a5d961b226b1f2f6fd30656b0a5db1e2763f07f0943e5797ed44e269a8a6192763fbd25d3569524dde5c4930ebeab289021825ac8a7e283
7
- data.tar.gz: 35483c4022a25d73fdfa8a5ee10eb136fce36192acc943fb7c98621f15d8abcf50014fd035135c65ea54dfe24e0b6e02fc990530017acc074f07da02734bfb9e
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
- === Search for a standard using keywords
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] ("OGC 19-025r1") fetching...
87
- [relaton-ogc] ("OGC 19-025r1") found 19-025r1
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 "[relaton-ogc] WARNING Duplicated documents: #{@dupids.to_a.join(', ')}" if @dupids.any?
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 "[relaton-ogc] WARNING: invalid document "\
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 "[relaton-ogc] (\"#{code}\") found #{ret[:ret].docidentifier.first.id}"
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 "[relaton-ogc] (\"#{code}\") fetching..."
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
- id = year ? "#{code} year #{year}" : code
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 "[relaton-ogc] (There was no match for #{year}, though there " \
75
- "were matches found for #{missed_years.join(', ')}.)"
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
@@ -75,6 +75,7 @@ module RelatonOgc
75
75
  # @param url [String]
76
76
  # @return [Array>RelatonBib::TypedUri>]
77
77
  def fetch_link(url)
78
+ # type = url.end_with?("pdf") ? "pdf" : "src"
78
79
  [RelatonBib::TypedUri.new(type: "obp", content: url)]
79
80
  end
80
81
 
@@ -1,3 +1,3 @@
1
1
  module RelatonOgc
2
- VERSION = "1.16.1".freeze
2
+ VERSION = "1.16.3".freeze
3
3
  end
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.1
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-09-22 00:00:00.000000000 Z
11
+ date: 2023-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday