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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 9c38e492127f30df4731cb63c803b01a03d6407aed7996b8d2338e189e829766
4
- data.tar.gz: 337e641026b11cc2acc445ea23f7c8ea9c0dc62ee390dc6e6e294d1656cc7eb2
2
+ SHA1:
3
+ metadata.gz: 667e47e4822cfa1b2a5d859e54bf8d6cd02c10b2
4
+ data.tar.gz: 0b33897f58d2885a821e3bf50176cafe87bc612a
5
5
  SHA512:
6
- metadata.gz: 8e05bf6bb5b5d386a08c90bf0d05021e72f5a884a354b9480a963c260e2c1c538e6df7ab329cad54a96144587ee29751af791ec53e480927f0ec5913e47ba178
7
- data.tar.gz: 397a78361ff21554e74b9b5f8dafffdc983dd1e28942ca0c0c04ac3e55faa1033ce236bfd4dd94fa84a7709b1fcebc4f66c90f3ba196cc17fb3b6d117ff35c94
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.0)
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.0)
37
+ public_suffix (3.1.1)
38
38
  rake (10.5.0)
39
- relaton-bib (0.2.0)
39
+ relaton-bib (0.2.3)
40
40
  addressable
41
41
  nokogiri (~> 1.8.4)
42
- relaton-iso-bib (0.2.0)
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)
@@ -38,9 +38,7 @@ module RelatonIec
38
38
  Hit.new({ code: code, title: title, url: url }, self)
39
39
  end
40
40
  concat hits
41
- # concat(hits.map { |h| Hit.new(h, self) })
42
41
  @fetched = false
43
- # @hit_pages = hit_pages
44
42
  end
45
43
 
46
44
  # @return [RelatonIec::HitCollection]
@@ -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
- warn "Could not access http://www.iec.ch"
18
- []
17
+ raise RelatonBib::RequestError, "Could not access http://www.iec.ch"
19
18
  end
20
19
 
21
20
  # @param text [String]
@@ -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
- if resp.code == "301"
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
 
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "0.3.0".freeze
2
+ VERSION = "0.3.1".freeze
3
3
  end
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.0
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-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
@@ -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.7.6
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