relaton-iso 0.5.0 → 0.5.1

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
- SHA256:
3
- metadata.gz: 7b2af6056b89b71d6ca4148fc52a3a1ea70735ef8f7aca140394ddd5418b71fe
4
- data.tar.gz: 6c2438c00e88c968aad812208b94b1fc406669a49fd927f43c2a359fba4dbd9c
2
+ SHA1:
3
+ metadata.gz: 5d15a988eb361c24d1cd59bf99f23b66421d19ba
4
+ data.tar.gz: 7718cbe3d0ec06f333e78b54b41535e3ba75c1b4
5
5
  SHA512:
6
- metadata.gz: de64ab29a1e7773af26ac8f37aa459e22cc8b06f3703a3b5db2a60b632a7e2eb4f0f50d80f31aedfce6c9a03ae9ec13be6512c509e460a4e7a6f818883be9eb0
7
- data.tar.gz: f308fe8715c389624984cdf25374e7013cb7e56427f495745a2a64745c9c83acc4c1e960684c91508ffa9d5fec1614aa74b7f62f2e83fed2844a2d1c1afb205d
6
+ metadata.gz: bc6c77ab77e9cb7d67fe0d6ea6b158efebe1235f5c795af5b55d7e9ad6d3b87af1b81e8d0fbea2ea1d893cb20975271132e41b3898e64ac1cf2cd09439825a5c
7
+ data.tar.gz: c00ee4222a3028db3eb5a0e50ba98906f3e9d60c52e1595bcb301b32f6ff9a9b813ed74f23dd8a0046d1f74da74e198cec31fb8cea54802e417471239b7deb7e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-iso (0.5.0)
4
+ relaton-iso (0.5.1)
5
5
  algoliasearch
6
6
  relaton-iec (~> 0.3.0)
7
7
  relaton-iso-bib (~> 0.2.0)
@@ -39,15 +39,15 @@ GEM
39
39
  pry-byebug (3.7.0)
40
40
  byebug (~> 11.0)
41
41
  pry (~> 0.10)
42
- public_suffix (3.1.0)
42
+ public_suffix (3.1.1)
43
43
  rake (10.5.0)
44
- relaton-bib (0.2.0)
44
+ relaton-bib (0.2.3)
45
45
  addressable
46
46
  nokogiri (~> 1.8.4)
47
47
  relaton-iec (0.3.0)
48
48
  addressable
49
49
  relaton-iso-bib (~> 0.2.0)
50
- relaton-iso-bib (0.2.0)
50
+ relaton-iso-bib (0.2.3)
51
51
  isoics (~> 0.1.6)
52
52
  nokogiri (~> 1.8.4)
53
53
  relaton-bib (~> 0.2.0)
@@ -13,9 +13,10 @@ module RelatonIso
13
13
  # @return [RelatonIso::HitPages]
14
14
  def search(text)
15
15
  HitPages.new text
16
- rescue Algolia::AlgoliaProtocolError
17
- warn "Could not access http://www.iso.org"
18
- []
16
+ rescue Algolia::AlgoliaProtocolError, SocketError
17
+ # warn "Could not access http://www.iso.org"
18
+ # []
19
+ raise RelatonBib::RequestError, "Could not access http://www.iso.org"
19
20
  end
20
21
 
21
22
  # @param text [String]
@@ -38,7 +39,7 @@ module RelatonIso
38
39
  end
39
40
  end
40
41
  code += "-1" if opts[:all_parts]
41
- return Iecbib::IecBibliography.get(code, year, opts) if %r[^ISO/IEC DIR].match code
42
+ return RelatonIec::IecBibliography.get(code, year, opts) if %r[^ISO/IEC DIR].match code
42
43
 
43
44
  ret = isobib_get1(code, year, opts)
44
45
  if ret.nil? && code =~ %r[^ISO\s]
@@ -176,11 +176,14 @@ module RelatonIso
176
176
  url = DOMAIN + path
177
177
  uri = URI url
178
178
  resp = Net::HTTP.get_response(uri) # .encode("UTF-8")
179
- if resp.code == "301"
179
+ case resp.code
180
+ when "301"
180
181
  path = resp["location"]
181
182
  url = DOMAIN + path
182
183
  uri = URI url
183
184
  resp = Net::HTTP.get_response(uri) # .encode("UTF-8")
185
+ when "404"
186
+ raise RelatonBib::RequestError, "#{url} not found."
184
187
  end
185
188
  n = 0
186
189
  while resp.body !~ /<strong/ && n < 10
@@ -188,6 +191,9 @@ module RelatonIso
188
191
  n += 1
189
192
  end
190
193
  [Nokogiri::HTML(resp.body), url]
194
+ rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
195
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
196
+ raise RelatonBib::RequestError, "Could not access #{url}"
191
197
  end
192
198
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
193
199
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
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-06-15 00:00:00.000000000 Z
11
+ date: 2019-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  version: '0'
271
271
  requirements: []
272
272
  rubyforge_project:
273
- rubygems_version: 2.7.6
273
+ rubygems_version: 2.6.12
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem