relaton-iso 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ffa0d2ff9da9226ea5e8f15547b794112a66c63
4
- data.tar.gz: 6a7705319268c1f2a26f582ef5720da15ddd0ad6
3
+ metadata.gz: 0cd1713b5b45deea5342727fdf5d4e0f21ad1f1c
4
+ data.tar.gz: 5e5da8b0e1906b439c778bb06b567b3ce761f9e7
5
5
  SHA512:
6
- metadata.gz: 922b59fc063a2e78e229af1d0f5458f97ff773bbd606bbff807ecad5374f0781d052fdeb6d1af9ca4b76e89a3ad980671b899eb7a0e82895b8505690f93e2efb
7
- data.tar.gz: 5b3bbbd6b383c9e660c4dd6abf116e11ab665f57f177616ce4207a72dcf9f31b602e771e65aceeae30394d563d59fae4a68ab893bb140a4f6214beffab0900f6
6
+ metadata.gz: 5a3e1b124cd67b2379929846e672c4d67dec7f6f55626dfae20fec7f6e2553821fee93475575a8ed85b5cc1a7dcf6c5bfc3f8862d4b21ea77d2579faff180bd6
7
+ data.tar.gz: 2a17996edade8a727267264f78f10eb099eccbaf9418343a38cba8789fc75d20f950c9a9845490a77aef8208ba90aac50891e6e91ceac7eea5023f09b0b43bf2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-iso (0.6.2)
4
+ relaton-iso (0.6.3)
5
5
  relaton-iec (~> 0.4.0)
6
6
  relaton-iso-bib (~> 0.3.0)
7
7
 
@@ -26,7 +26,7 @@ GEM
26
26
  json (2.2.0)
27
27
  method_source (0.9.2)
28
28
  mini_portile2 (2.4.0)
29
- nokogiri (1.10.3)
29
+ nokogiri (1.10.4)
30
30
  mini_portile2 (~> 2.4.0)
31
31
  pry (0.12.2)
32
32
  coderay (~> 1.1.0)
@@ -36,13 +36,13 @@ GEM
36
36
  pry (~> 0.10)
37
37
  public_suffix (3.1.1)
38
38
  rake (10.5.0)
39
- relaton-bib (0.3.2)
39
+ relaton-bib (0.3.4)
40
40
  addressable
41
41
  nokogiri (~> 1.10)
42
42
  relaton-iec (0.4.2)
43
43
  addressable
44
44
  relaton-iso-bib (~> 0.3.0)
45
- relaton-iso-bib (0.3.2)
45
+ relaton-iso-bib (0.3.3)
46
46
  isoics (~> 0.1.6)
47
47
  relaton-bib (~> 0.3.0)
48
48
  ruby_deep_clone (~> 0.8.0)
@@ -14,7 +14,8 @@ module RelatonIso
14
14
  def search(text)
15
15
  HitCollection.new text
16
16
  rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
17
- Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
17
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
18
+ OpenSSL::SSL::SSLError
18
19
  raise RelatonBib::RequestError, "Could not access http://www.iso.org"
19
20
  end
20
21
 
@@ -155,7 +155,7 @@ module RelatonIso
155
155
  # @return [Array<Hash>]
156
156
  def langs(doc)
157
157
  lgs = [{ lang: "en" }]
158
- doc.css("ul#lang-switcher ul li a").each do |lang_link|
158
+ doc.css("li#lang-switcher ul li a").each do |lang_link|
159
159
  lang_path = lang_link.attr("href")
160
160
  lang = lang_path.match(%r{^\/(fr)\/})
161
161
  lgs << { lang: lang[1], path: lang_path } if lang
@@ -187,7 +187,8 @@ module RelatonIso
187
187
  end
188
188
  [Nokogiri::HTML(resp.body), url]
189
189
  rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,
190
- Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
190
+ Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError,
191
+ OpenSSL::SSL::SSLError
191
192
  raise RelatonBib::RequestError, "Could not access #{url}"
192
193
  end
193
194
  # rubocop:enable Metrics/AbcSize, Metrics/MethodLength
@@ -196,7 +197,7 @@ module RelatonIso
196
197
  # @param doc [Nokogiri::HTML::Document]
197
198
  # @return [Array<RelatonBib::DocumentIdentifier>]
198
199
  def fetch_docid(doc)
199
- item_ref = doc.at("//strong[@id='itemReference']")
200
+ item_ref = doc.at("//nav[contains(@class, 'heading-condensed')]/h1")
200
201
  return [] unless item_ref
201
202
 
202
203
  [RelatonBib::DocumentIdentifier.new(id: item_ref.text, type: "ISO")]
@@ -204,7 +205,7 @@ module RelatonIso
204
205
 
205
206
  # @param doc [Nokogiri::HTML::Document]
206
207
  def fetch_structuredidentifier(doc)
207
- item_ref = doc.at("//strong[@id='itemReference']")
208
+ item_ref = doc.at("//nav[contains(@class, 'heading-condensed')]/h1")
208
209
  unless item_ref
209
210
  return RelatonIsoBib::StructuredIdentifier.new(
210
211
  project_number: "?", part_number: "", prefix: nil, id: "?",
@@ -301,7 +302,7 @@ module RelatonIso
301
302
  # @return [Hash]
302
303
  def fetch_title(doc, lang)
303
304
  content = doc.at(
304
- "//h3[@itemprop='description'] | //h2[@itemprop='description']",
305
+ "//nav[contains(@class,'eading-condensed')]/h2 | //nav[contains(@class,'eading-condensed')]/h3",
305
306
  )&.text
306
307
  RelatonIsoBib::HashConverter.split_title content, lang, script(lang)
307
308
  end
@@ -376,7 +377,7 @@ module RelatonIso
376
377
  # @return [Array<Hash>]
377
378
  def fetch_link(doc, url)
378
379
  links = [{ type: "src", content: url }]
379
- obp = doc.at("//a[contains(@href, '/obp/ui/')]")
380
+ obp = doc.at_css("a#obp-preview")
380
381
  links << { type: "obp", content: obp[:href] } if obp
381
382
  rss = doc.at("//a[contains(@href, 'rss')]")
382
383
  links << { type: "rss", content: DOMAIN + rss[:href] } if rss
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "0.6.2"
4
+ VERSION = "0.6.3"
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.6.2
4
+ version: 0.6.3
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-08-02 00:00:00.000000000 Z
11
+ date: 2019-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler