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: dbbd5332f2c47a2de145110cebace2a9fd91fcfcc9f5e5b37db61b7203f2bf10
4
- data.tar.gz: a830835c018df8c96ac32ef46264ce1a52b5b455922daf1e980737a87523e5d9
3
+ metadata.gz: 05c98319d9aaeffbc9273d3afcf704446af3345ca14acf6ac663b07256711298
4
+ data.tar.gz: 6cb96b00ba454d3c3860d07c9f2508bc61d28534152d7aa8b96788925226f6fa
5
5
  SHA512:
6
- metadata.gz: 7eb8ac27db7aedd17027f43882059fca8c9fd611c9bfa1761462336fe3a6866704bc09dc3dbc576ff9caf9a4775019e91384b209334f0051660db0678396b75c
7
- data.tar.gz: a4aeaae6457b15a3f9dc3a8165af5a8c5fd4361575b0d5ea3bd5f930afd5815b0fee26ffe648f68fc9599896a13a37a0d73286fc8917cccec5f21fd4c59b696d
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
- docs = LocMods::Collection.from_xml OpenURI.open_uri(URL).read
74
- # docs.xpath(
75
- # "/body/query/doi_record/report-paper/report-paper_metadata",
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 < OpenURI.open_uri("#{PUBS_EXPORT}.meta").last_modified
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
- yaml = OpenURI.open_uri "#{HitCollection::GHNISTDATA}#{hit_data[:path]}"
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
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.20.1".freeze
2
+ VERSION = "1.20.2".freeze
3
3
  end
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.1
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: 2025-11-27 00:00:00.000000000 Z
11
+ date: 2026-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64