relaton-ieee 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relaton_ieee/data_fetcher.rb +2 -2
- data/lib/relaton_ieee/hit_collection.rb +9 -13
- data/lib/relaton_ieee/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c9ad7ed0600b55a10bf86c90d4e9a0bd0b7b7b39f15b4162456227e3a79dd44
|
4
|
+
data.tar.gz: 35070ebc17399869b94e03cfb6922b29b3c57ab3d9e08d81e495fa5e25cdf199
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
24
|
-
|
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
|
data/lib/relaton_ieee/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2022-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|