relaton-calconnect 0.2.1 → 0.3.0

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: 404577ba181bef9338ec6f924ebbba1ca4c2865007726eefdb2a0377cc3920a7
4
- data.tar.gz: 47c664cad7285a7df4361452f22c011ab7cfbdca0f6bc962dd671add7eb2ad4b
3
+ metadata.gz: 75cd96311bc9d733df4437f05c3d2b0a9569d0337931ca9a78f32aa190149195
4
+ data.tar.gz: 4af9889521433e624cf5f5b16317c361467cf3d496eb1f71013fa2ac02ce7c8c
5
5
  SHA512:
6
- metadata.gz: 187442955bd472db4cfd2a702c9d91dbdce7d311fabb5b395ae7bafbbe68536270d9c05c8c0fe0d12544f1aa7accec4ad5d904517c7ee8a153471f6a2aa72abb
7
- data.tar.gz: 7a2bc22cc7fb6ed229f264a7d8e130f1798165968eb2c520811f2c623328e95005f3c59fd61948f8c737affcf2f5b53abf070451930e0ae73f77eef78dff1037
6
+ metadata.gz: 0d0c5017fd6d1475f26ac80743691731fcbae5ba2596f0bd792a6c8aafecfe4e0a352a011ee7282d79c6c1f98d45ee6ec79d80b1d6207c2b20524ca880e28305
7
+ data.tar.gz: 5d3a9b8f81111de7c1db67f31e6cb21b5592bd64733c82e4d7963d646e29aa5a53b5c6a18af5b80b303e1179f9b52ba16c0c640369e2e014193fd24dbd06bee3
data/.gitignore CHANGED
@@ -11,3 +11,4 @@
11
11
  .rspec_status
12
12
  .rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
13
13
  .vscode/
14
+ Gemfile.lock
data/grammars/biblio.rng CHANGED
@@ -638,9 +638,9 @@
638
638
  <zeroOrMore>
639
639
  <ref name="license"/>
640
640
  </zeroOrMore>
641
- <optional>
641
+ <zeroOrMore>
642
642
  <ref name="bclassification"/>
643
- </optional>
643
+ </zeroOrMore>
644
644
  <zeroOrMore>
645
645
  <ref name="bkeyword"/>
646
646
  </zeroOrMore>
@@ -5,11 +5,11 @@ module RelatonCalconnect
5
5
  # @return [RelatonCalconnect::HitCollection]
6
6
  def search(text, year = nil, opts = {})
7
7
  HitCollection.new text, year, opts
8
- rescue Faraday::Error::ConnectionFailed
8
+ rescue Faraday::ConnectionFailed
9
9
  raise RelatonBib::RequestError, "Could not access https://standards.calconnect.org"
10
10
  end
11
11
 
12
- # @param code [String] the OGC standard Code to look up (e..g "8200")
12
+ # @param ref [String] the OGC standard Code to look up (e..g "8200")
13
13
  # @param year [String] the year the standard was published (optional)
14
14
  #
15
15
  # @param opts [Hash] options
@@ -18,26 +18,31 @@ module RelatonCalconnect
18
18
  # @option opts [TrueClass, FalseClass] :bibdata
19
19
  #
20
20
  # @return [RelatonCalconnect::CcBibliographicItem]
21
- def get(code, year = nil, opts = {})
21
+ def get(ref, year = nil, opts = {})
22
+ code = ref
23
+
22
24
  if year.nil?
23
- /^(?<code1>[^\s]+(\s\w+)?\s[\d-]+):?(?<year1>\d{4})?/ =~ code
25
+ /^(?<code1>[^\s]+(\s\w+)?\s[\d-]+):?(?<year1>\d{4})?/ =~ ref
24
26
  unless code1.nil?
25
27
  code = code1
26
28
  year = year1
27
29
  end
28
30
  end
29
31
 
32
+ warn "[relaton-calconnect] (\"#{ref}\") fetching..."
30
33
  result = bib_search_filter(code, year, opts) || (return nil)
31
34
  ret = bib_results_filter(result, year)
32
- return ret[:ret] if ret[:ret]
33
-
34
- fetch_ref_err(code, year, ret[:years])
35
+ if ret[:ret]
36
+ warn "[relaton-calconnect] (\"#{ref}\") found #{ret[:ret].docidentifier.first.id}"
37
+ ret[:ret]
38
+ else
39
+ fetch_ref_err(code, year, ret[:years])
40
+ end
35
41
  end
36
42
 
37
43
  private
38
44
 
39
45
  def bib_search_filter(code, year, opts)
40
- warn "fetching #{code}..."
41
46
  search(code, year, opts)
42
47
  end
43
48
 
@@ -72,10 +77,10 @@ module RelatonCalconnect
72
77
  # @param missed_years [Array<Strig>]
73
78
  def fetch_ref_err(code, year, missed_years)
74
79
  id = year ? "#{code} year #{year}" : code
75
- warn "WARNING: no match found online for #{id}. "\
80
+ warn "[relaton-calconnect] WARNING: no match found online for #{id}. "\
76
81
  "The code must be exactly like it is on the standards website."
77
82
  unless missed_years.empty?
78
- warn "(There was no match for #{year}, though there were matches "\
83
+ warn "[relaton-calconnect] (There was no match for #{year}, though there were matches "\
79
84
  "found for #{missed_years.join(', ')}.)"
80
85
  end
81
86
  nil
@@ -1,3 +1,3 @@
1
1
  module RelatonCalconnect
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
- spec.add_development_dependency "bundler", "~> 2.0"
30
29
  spec.add_development_dependency "debase"
31
30
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
32
31
  spec.add_development_dependency "rake", "~> 10.0"
@@ -38,5 +37,5 @@ Gem::Specification.new do |spec|
38
37
  spec.add_development_dependency "webmock"
39
38
 
40
39
  spec.add_dependency "faraday"
41
- spec.add_dependency "relaton-iso-bib", "~> 0.4.0"
40
+ spec.add_dependency "relaton-iso-bib", "~> 0.5.0"
42
41
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-calconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.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: 2019-12-16 00:00:00.000000000 Z
11
+ date: 2020-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '2.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '2.0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: debase
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +156,14 @@ dependencies:
170
156
  requirements:
171
157
  - - "~>"
172
158
  - !ruby/object:Gem::Version
173
- version: 0.4.0
159
+ version: 0.5.0
174
160
  type: :runtime
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - "~>"
179
165
  - !ruby/object:Gem::Version
180
- version: 0.4.0
166
+ version: 0.5.0
181
167
  description: 'RelatonIso: retrieve CC Standards for bibliographic use using the IsoBibliographicItem
182
168
  model'
183
169
  email:
@@ -193,7 +179,6 @@ files:
193
179
  - ".rspec"
194
180
  - ".rubocop.yml"
195
181
  - Gemfile
196
- - Gemfile.lock
197
182
  - LICENSE.txt
198
183
  - README.adoc
199
184
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,88 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- relaton-calconnect (0.2.1)
5
- faraday
6
- relaton-iso-bib (~> 0.4.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.7.0)
12
- public_suffix (>= 2.0.2, < 5.0)
13
- crack (0.4.3)
14
- safe_yaml (~> 1.0.0)
15
- debase (0.2.4.1)
16
- debase-ruby_core_source (>= 0.10.2)
17
- debase-ruby_core_source (0.10.5)
18
- diff-lcs (1.3)
19
- docile (1.3.2)
20
- equivalent-xml (0.6.0)
21
- nokogiri (>= 1.4.3)
22
- faraday (0.17.1)
23
- multipart-post (>= 1.2, < 3)
24
- hashdiff (1.0.0)
25
- isoics (0.1.8)
26
- json (2.2.0)
27
- mini_portile2 (2.4.0)
28
- multipart-post (2.1.1)
29
- nokogiri (1.10.7)
30
- mini_portile2 (~> 2.4.0)
31
- optout (0.0.2)
32
- public_suffix (4.0.1)
33
- rake (10.5.0)
34
- relaton-bib (0.4.1)
35
- addressable
36
- nokogiri
37
- relaton-iso-bib (0.4.1)
38
- isoics (~> 0.1.6)
39
- relaton-bib (~> 0.4.0)
40
- ruby_deep_clone (~> 0.8.0)
41
- rspec (3.8.0)
42
- rspec-core (~> 3.8.0)
43
- rspec-expectations (~> 3.8.0)
44
- rspec-mocks (~> 3.8.0)
45
- rspec-core (3.8.2)
46
- rspec-support (~> 3.8.0)
47
- rspec-expectations (3.8.4)
48
- diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.8.0)
50
- rspec-mocks (3.8.1)
51
- diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.8.0)
53
- rspec-support (3.8.2)
54
- ruby-debug-ide (0.7.0)
55
- rake (>= 0.8.1)
56
- ruby-jing (0.0.1)
57
- optout (>= 0.0.2)
58
- ruby_deep_clone (0.8.0)
59
- safe_yaml (1.0.5)
60
- simplecov (0.17.1)
61
- docile (~> 1.1)
62
- json (>= 1.8, < 3)
63
- simplecov-html (~> 0.10.0)
64
- simplecov-html (0.10.2)
65
- vcr (5.0.0)
66
- webmock (3.7.1)
67
- addressable (>= 2.3.6)
68
- crack (>= 0.3.2)
69
- hashdiff (>= 0.4.0, < 2.0.0)
70
-
71
- PLATFORMS
72
- ruby
73
-
74
- DEPENDENCIES
75
- bundler (~> 2.0)
76
- debase
77
- equivalent-xml (~> 0.6)
78
- rake (~> 10.0)
79
- relaton-calconnect!
80
- rspec (~> 3.0)
81
- ruby-debug-ide
82
- ruby-jing
83
- simplecov
84
- vcr
85
- webmock
86
-
87
- BUNDLED WITH
88
- 2.0.2