relaton-ieee 1.12.0 → 1.12.1

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
  SHA256:
3
- metadata.gz: 2dffd3e986054d23676fefc4e3d57e37186ea420407224f37f67c9d44824a87c
4
- data.tar.gz: eda62a34d92c61fbeeea89e3d1afe377f83c35f6a36c4b3eb3728440b3da0f9a
3
+ metadata.gz: 7c9ad7ed0600b55a10bf86c90d4e9a0bd0b7b7b39f15b4162456227e3a79dd44
4
+ data.tar.gz: 35070ebc17399869b94e03cfb6922b29b3c57ab3d9e08d81e495fa5e25cdf199
5
5
  SHA512:
6
- metadata.gz: 7d5d70f1b96276413acff519ef6f374c2469eb7bf9c0dcd086ad43d528ed3ae84ca606d7a8acf38c39c004541e2f03e473917d14a94b82560d66984811214389
7
- data.tar.gz: 2ba1263ea7569e1682590d3bbd4fcec4b27ffb2d539ec925d732ba8d33a3d3c3195bea0834257565a17576323d91deca372feed55dcdfcddb0174d83d1b9b947
6
+ metadata.gz: 76541d16ef2c5b0e167f819306a4bcdf7ccc2d253eec34e8b442f70a27a3090b04722d3dd01e9d7b05d39408b2dc3b2cda7a9f4a81b77883ce289fb6929395ca
7
+ data.tar.gz: 1dad051905cc2721348fb90bd5ae758093b16aca56c5f435661bdfdeda05456ee198eb66fa0d46c49993d95e0ec5b798c50aef49d9104b553ff192f28fede4c0
@@ -44,7 +44,7 @@ module RelatonIeee
44
44
  def self.fetch(output: "data", format: "yaml")
45
45
  t1 = Time.now
46
46
  puts "Started at: #{t1}"
47
- FileUtils.mkdir_p output unless Dir.exist? output
47
+ FileUtils.mkdir_p output # unless Dir.exist? output
48
48
  new(output, format).fetch
49
49
  t2 = Time.now
50
50
  puts "Stopped at: #{t2}"
@@ -113,7 +113,7 @@ module RelatonIeee
113
113
  amsid = doc.at("./publicationinfo/amsid").text
114
114
  if backrefs.value?(bib.docidentifier[0].id) && /updates\.\d+/ !~ filename
115
115
  oamsid = backrefs.key bib.docidentifier[0].id
116
- warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: "\
116
+ warn "Document exists ID: \"#{bib.docidentifier[0].id}\" AMSID: " \
117
117
  "\"#{amsid}\" source: \"#{filename}\". Other AMSID: \"#{oamsid}\""
118
118
  if bib.docidentifier[0].id.include?(doc.at("./publicationinfo/stdnumber").text)
119
119
  save_doc bib # rewrite file if the PubID matches to the stdnumber
@@ -5,40 +5,36 @@ require "fileutils"
5
5
  module RelatonIeee
6
6
  class HitCollection < RelatonBib::HitCollection
7
7
  DOMAIN = "https://standards.ieee.org".freeze
8
- DATADIR = File.expand_path ".relaton/ogc/", Dir.home
9
- DATAFILE = File.expand_path "bibliography.json", DATADIR
10
- ETAGFILE = File.expand_path "etag.txt", DATADIR
11
-
12
- # rubocop:disable Metrics/AbcSize
8
+ # DATADIR = File.expand_path ".relaton/ogc/", Dir.home
9
+ # DATAFILE = File.expand_path "bibliography.json", DATADIR
10
+ # ETAGFILE = File.expand_path "etag.txt", DATADIR
13
11
 
14
12
  # @param reference [Strig]
15
13
  # @param opts [Hash]
16
- def initialize(reference) # rubocop:disable Metrics/MethodLength
14
+ def initialize(reference) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
17
15
  super
18
16
  code1 = reference.sub(/^IEEE\s(Std\s)?/, "")
19
17
  url = "#{DOMAIN}/wp-admin/admin-ajax.php"
20
18
  query = reference.gsub("/", " ")
21
19
  resp = Faraday.post url, { action: "ieee_cloudsearch", q: query }
22
20
  json = JSON.parse resp.body
23
- # html = Nokogiri::HTML json["html"]
24
- # @array = html.xpath("//h4/a").reduce([]) do |s, hit|
21
+ unless json["results"]
22
+ @array = []
23
+ return
24
+ end
25
+
25
26
  @array = json["results"]["hits"]["hit"].reduce([]) do |s, hit|
26
27
  flds = hit["fields"]
27
- # ref = hit.text.strip
28
- # /^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ ref
29
28
  /^(?:\w+\s)?(?<code2>[A-Z\d.]+)(?:-(?<year>\d{4}))?/ =~ flds["meta_designation_l"]
30
29
  next s unless code2 && code1 =~ %r{^#{code2}}
31
30
 
32
31
  hit_data = {
33
32
  ref: flds["meta_designation_l"],
34
- # title: flds["meta_title_t"],
35
- # abstract: flds["meta_description_l"],
36
33
  year: year.to_i,
37
34
  url: flds["doc_id_l"],
38
35
  }
39
36
  s << Hit.new(hit_data, self)
40
37
  end.sort_by { |h| h.hit[:year].to_s + h.hit[:url] }.reverse
41
38
  end
42
- # rubocop:enable Metrics/AbcSize
43
39
  end
44
40
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIeee
2
- VERSION = "1.12.0".freeze
2
+ VERSION = "1.12.1".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-ieee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.12.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: 2022-06-25 00:00:00.000000000 Z
11
+ date: 2022-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml