relaton-iec 0.3.0 → 0.3.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_iec/hit_collection.rb +0 -2
- data/lib/relaton_iec/iec_bibliography.rb +1 -2
- data/lib/relaton_iec/scrapper.rb +7 -1
- data/lib/relaton_iec/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: 667e47e4822cfa1b2a5d859e54bf8d6cd02c10b2
|
4
|
+
data.tar.gz: 0b33897f58d2885a821e3bf50176cafe87bc612a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5839240e8709913e296366560ae0c1173bc5aa156132b21f30229730bb1275602d466491f34ba17c557c02f2ec018fb8fb913a250dc3e0b73a015b8f07fbe143
|
7
|
+
data.tar.gz: 1e3d6c251548e5344c55389dd93221e02167cf2dd91cbb5881faa5f1279b5b455cd62472ee71a4e50bb09743b31ffc91bb35a0f10071c3a1b9ae846751747723
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
relaton-iec (0.3.
|
4
|
+
relaton-iec (0.3.1)
|
5
5
|
addressable
|
6
6
|
relaton-iso-bib (~> 0.2.0)
|
7
7
|
|
@@ -34,12 +34,12 @@ GEM
|
|
34
34
|
pry-byebug (3.7.0)
|
35
35
|
byebug (~> 11.0)
|
36
36
|
pry (~> 0.10)
|
37
|
-
public_suffix (3.1.
|
37
|
+
public_suffix (3.1.1)
|
38
38
|
rake (10.5.0)
|
39
|
-
relaton-bib (0.2.
|
39
|
+
relaton-bib (0.2.3)
|
40
40
|
addressable
|
41
41
|
nokogiri (~> 1.8.4)
|
42
|
-
relaton-iso-bib (0.2.
|
42
|
+
relaton-iso-bib (0.2.3)
|
43
43
|
isoics (~> 0.1.6)
|
44
44
|
nokogiri (~> 1.8.4)
|
45
45
|
relaton-bib (~> 0.2.0)
|
@@ -14,8 +14,7 @@ module RelatonIec
|
|
14
14
|
def search(text, year = nil)
|
15
15
|
HitCollection.new text, year
|
16
16
|
rescue SocketError, OpenURI::HTTPError
|
17
|
-
|
18
|
-
[]
|
17
|
+
raise RelatonBib::RequestError, "Could not access http://www.iec.ch"
|
19
18
|
end
|
20
19
|
|
21
20
|
# @param text [String]
|
data/lib/relaton_iec/scrapper.rb
CHANGED
@@ -153,11 +153,14 @@ module RelatonIec
|
|
153
153
|
def get_page(url)
|
154
154
|
uri = URI url
|
155
155
|
resp = Net::HTTP.get_response(uri) # .encode("UTF-8")
|
156
|
-
|
156
|
+
case resp.code
|
157
|
+
when "301"
|
157
158
|
path = resp["location"]
|
158
159
|
url = DOMAIN + path
|
159
160
|
uri = URI url
|
160
161
|
resp = Net::HTTP.get_response(uri) # .encode("UTF-8")
|
162
|
+
when "404"
|
163
|
+
raise RelatonBib::RequestError, "Page not found #{url}"
|
161
164
|
end
|
162
165
|
# n = 0
|
163
166
|
# while resp.body !~ /<strong/ && n < 10
|
@@ -165,6 +168,9 @@ module RelatonIec
|
|
165
168
|
# n += 1
|
166
169
|
# end
|
167
170
|
Nokogiri::HTML(resp.body)
|
171
|
+
rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
|
172
|
+
Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
|
173
|
+
raise RelatonBib::RequestError, "Could not access #{url}"
|
168
174
|
end
|
169
175
|
# rubocop:enable Metrics/AbcSize
|
170
176
|
|
data/lib/relaton_iec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.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
|
@@ -227,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
requirements: []
|
229
229
|
rubyforge_project:
|
230
|
-
rubygems_version: 2.
|
230
|
+
rubygems_version: 2.6.12
|
231
231
|
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IsoBibliographicItem
|