relaton-iso 0.6.3 → 0.6.4

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
2
  SHA1:
3
- metadata.gz: 0cd1713b5b45deea5342727fdf5d4e0f21ad1f1c
4
- data.tar.gz: 5e5da8b0e1906b439c778bb06b567b3ce761f9e7
3
+ metadata.gz: 66e86b23d321882dcc79e8f5fb47fbde454b238e
4
+ data.tar.gz: c9c1e37df8b4054e274ed5a77737a7e909380873
5
5
  SHA512:
6
- metadata.gz: 5a3e1b124cd67b2379929846e672c4d67dec7f6f55626dfae20fec7f6e2553821fee93475575a8ed85b5cc1a7dcf6c5bfc3f8862d4b21ea77d2579faff180bd6
7
- data.tar.gz: 2a17996edade8a727267264f78f10eb099eccbaf9418343a38cba8789fc75d20f950c9a9845490a77aef8208ba90aac50891e6e91ceac7eea5023f09b0b43bf2
6
+ metadata.gz: 6f70fc424d1fcbbd786b1389412a170f7e48d589cf030771ea6847824f8cf62b379f34ba22df82b94f7b5663981a166654eed16b08eeab69fc2cc14ee971fa15
7
+ data.tar.gz: e2fc938d41c9c1d8d59d81388d6b653757c66f4e2eb6158284f540a8394427bb68adc3d0fe342742a98ea11e9485a20ea70000f42566d72003d9773b365d8f47
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- relaton-iso (0.6.3)
4
+ relaton-iso (0.6.4)
5
5
  relaton-iec (~> 0.4.0)
6
6
  relaton-iso-bib (~> 0.3.0)
7
7
 
@@ -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.4)
39
+ relaton-bib (0.3.5)
40
40
  addressable
41
41
  nokogiri (~> 1.10)
42
- relaton-iec (0.4.2)
42
+ relaton-iec (0.4.3)
43
43
  addressable
44
44
  relaton-iso-bib (~> 0.3.0)
45
- relaton-iso-bib (0.3.3)
45
+ relaton-iso-bib (0.3.4)
46
46
  isoics (~> 0.1.6)
47
47
  relaton-bib (~> 0.3.0)
48
48
  ruby_deep_clone (~> 0.8.0)
@@ -27,10 +27,8 @@ module RelatonIso
27
27
  search << "docNumber=#{num}"
28
28
  search << "docPartNo=#{part}" if part
29
29
  q = search.join "&"
30
- resp = http.get(
31
- "/cms/render/live/en/sites/isoorg.advancedSearch.do?#{q}",
32
- { 'Accept' => 'application/json, text/plain, */*' }
33
- )
30
+ resp = http.get("/cms/render/live/en/sites/isoorg.advancedSearch.do?#{q}",
31
+ "Accept" => "application/json, text/plain, */*")
34
32
  return if resp.body.empty?
35
33
 
36
34
  json = JSON.parse resp.body
@@ -44,19 +42,6 @@ module RelatonIso
44
42
  end
45
43
  end
46
44
 
47
- # @return [RelatonIso::HitCollection]
48
- # def fetch
49
- # workers = RelatonBib::WorkersPool.new 4
50
- # workers.worker(&:fetch)
51
- # each do |hit|
52
- # workers << hit
53
- # end
54
- # workers.end
55
- # workers.result
56
- # @fetched = true
57
- # self
58
- # end
59
-
60
45
  def to_s
61
46
  inspect
62
47
  end
@@ -116,7 +116,7 @@ module RelatonIso
116
116
  end
117
117
 
118
118
  def try_stages(result, corr)
119
- %w[NP WD CD DIS FDIS PRF IS].each do |st| # try stages
119
+ %w[NP WD CD DIS FDIS PRF IS AWI].each do |st| # try stages
120
120
  warn "Attempting #{st} stage retrieval"
121
121
  c = yield st
122
122
  res = search_code result, c, corr
@@ -26,21 +26,6 @@ module RelatonIso
26
26
  }.freeze
27
27
 
28
28
  class << self
29
- # @param text [String]
30
- # @return [Array<Hash>]
31
- # def get(text)
32
- # iso_workers = RelatonBib::WorkersPool.new 4
33
- # iso_workers.worker { |hit| iso_worker(hit, iso_workers) }
34
- # algolia_workers = start_algolia_search(text, iso_workers)
35
- # iso_docs = iso_workers.result
36
- # algolia_workers.end
37
- # algolia_workers.result
38
- # iso_docs
39
- # rescue
40
- # warn "Could not connect to http://www.iso.org"
41
- # []
42
- # end
43
-
44
29
  # Parse page.
45
30
  # @param hit [Hash]
46
31
  # @return [Hash]
@@ -58,6 +43,7 @@ module RelatonIso
58
43
  RelatonIsoBib::IsoBibliographicItem.new(
59
44
  fetched: Date.today.to_s,
60
45
  docid: fetch_docid(doc),
46
+ docnumber: fetch_docnumber(doc),
61
47
  edition: edition,
62
48
  language: langs(doc).map { |l| l[:lang] },
63
49
  script: langs(doc).map { |l| script(l[:lang]) }.uniq,
@@ -203,6 +189,11 @@ module RelatonIso
203
189
  [RelatonBib::DocumentIdentifier.new(id: item_ref.text, type: "ISO")]
204
190
  end
205
191
 
192
+ def fetch_docnumber(doc)
193
+ id = doc.at("//nav[contains(@class, 'heading-condensed')]/h1")&.text
194
+ id&.match(/\d+/)&.to_s
195
+ end
196
+
206
197
  # @param doc [Nokogiri::HTML::Document]
207
198
  def fetch_structuredidentifier(doc)
208
199
  item_ref = doc.at("//nav[contains(@class, 'heading-condensed')]/h1")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonIso
4
- VERSION = "0.6.3"
4
+ VERSION = "0.6.4"
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.3
4
+ version: 0.6.4
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-13 00:00:00.000000000 Z
11
+ date: 2019-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler