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 +5 -5
- data/Gemfile.lock +4 -4
- data/lib/relaton_iso/iso_bibliography.rb +5 -4
- data/lib/relaton_iso/scrapper.rb +7 -1
- data/lib/relaton_iso/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5d15a988eb361c24d1cd59bf99f23b66421d19ba
|
4
|
+
data.tar.gz: 7718cbe3d0ec06f333e78b54b41535e3ba75c1b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
42
|
+
public_suffix (3.1.1)
|
43
43
|
rake (10.5.0)
|
44
|
-
relaton-bib (0.2.
|
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.
|
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
|
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]
|
data/lib/relaton_iso/scrapper.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/relaton_iso/version.rb
CHANGED
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.
|
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-
|
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.
|
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
|