relaton-nist 1.20.1 → 1.20.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 05c98319d9aaeffbc9273d3afcf704446af3345ca14acf6ac663b07256711298
|
|
4
|
+
data.tar.gz: 6cb96b00ba454d3c3860d07c9f2508bc61d28534152d7aa8b96788925226f6fa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf35839459e60f1b9d09fe11621b62e70629cf7503bf7dbd54b8f33f9d5090a8240118bf8c7d9eae27471e1d9bc21517b0fee0edfe66b7fb5ca8f75022cc57c0
|
|
7
|
+
data.tar.gz: 1d58efefcf082a53376c6cf4b25201b6b5f6f1c9421584a5fc2639b7429a4eb4b8aaf9ddfc58dc292bcd1b513b1330b060e256c3be6bf0fde785e0e2666f11bf
|
|
@@ -70,10 +70,9 @@ module RelatonNist
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def fetch_tech_pubs
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
# )
|
|
73
|
+
uri = URI(URL)
|
|
74
|
+
xml_data = Net::HTTP.get(uri)
|
|
75
|
+
docs = LocMods::Collection.from_xml xml_data
|
|
77
76
|
docs.mods.each { |doc| write_file ModsParser.new(doc, series).parse }
|
|
78
77
|
end
|
|
79
78
|
|
|
@@ -4,7 +4,8 @@ require "zip"
|
|
|
4
4
|
require "fileutils"
|
|
5
5
|
require "relaton_nist/hit"
|
|
6
6
|
require "addressable/uri"
|
|
7
|
-
require "open-uri"
|
|
7
|
+
# require "open-uri"
|
|
8
|
+
require "net/http"
|
|
8
9
|
|
|
9
10
|
module RelatonNist
|
|
10
11
|
# Hit collection.
|
|
@@ -203,24 +204,13 @@ module RelatonNist
|
|
|
203
204
|
def from_ga # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
204
205
|
Util.info "Fetching from Relaton repository ...", key: @reference
|
|
205
206
|
ref = pubid
|
|
206
|
-
# return [] if ref.empty?
|
|
207
207
|
|
|
208
|
-
# fn = ref.gsub(%r{[/\s:.]}, "_").upcase
|
|
209
208
|
index = Relaton::Index.find_or_create :nist, url: "#{GHNISTDATA}index-v1.zip", file: INDEX_FILE
|
|
210
209
|
rows = index.search(ref).sort_by { |r| r[:id] }
|
|
211
|
-
# return [] unless row
|
|
212
|
-
|
|
213
|
-
# yaml = OpenURI.open_uri "#{GHNISTDATA}#{row[:file]}"
|
|
214
|
-
# hash = YAML.safe_load yaml
|
|
215
|
-
# hash["fetched"] = Date.today.to_s
|
|
216
|
-
# bib = RelatonNist::NistBibliographicItem.from_hash hash
|
|
217
|
-
# id = bib.docidentifier.find(&:primary).id
|
|
218
210
|
|
|
219
211
|
rows.map do |row|
|
|
220
212
|
Hit.new({ code: row[:id], path: row[:file] }, self)
|
|
221
213
|
end
|
|
222
|
-
# hit.fetch = bib
|
|
223
|
-
# [hit]
|
|
224
214
|
rescue OpenURI::HTTPError => e
|
|
225
215
|
return [] if e.io.status[0] == "404"
|
|
226
216
|
|
|
@@ -36,7 +36,7 @@ module RelatonNist
|
|
|
36
36
|
# @prarm ctime [Time, nil] file creation time
|
|
37
37
|
#
|
|
38
38
|
def fetch_data(ctime)
|
|
39
|
-
if !ctime || ctime <
|
|
39
|
+
if !ctime || ctime < last_modified
|
|
40
40
|
@data = nil
|
|
41
41
|
uri_open = URI.method(:open) || Kernel.method(:open)
|
|
42
42
|
FileUtils.mkdir_p DATAFILEDIR
|
|
@@ -44,6 +44,13 @@ module RelatonNist
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
def last_modified
|
|
48
|
+
uri = URI("#{PUBS_EXPORT}.meta")
|
|
49
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
|
50
|
+
Time.httpdate(http.head(uri.request_uri)['last-modified'])
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
47
54
|
#
|
|
48
55
|
# upack zip file
|
|
49
56
|
#
|
|
@@ -15,7 +15,8 @@ module RelatonNist
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def fetch_gh(hit_data)
|
|
18
|
-
|
|
18
|
+
uri = URI.parse "#{HitCollection::GHNISTDATA}#{hit_data[:path]}"
|
|
19
|
+
yaml = Net::HTTP.get(uri)
|
|
19
20
|
hash = YAML.safe_load yaml
|
|
20
21
|
hash["fetched"] = Date.today.to_s
|
|
21
22
|
NistBibliographicItem.from_hash hash
|
data/lib/relaton_nist/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-nist
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.20.
|
|
4
|
+
version: 1.20.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|