relaton-nist 1.19.6 → 1.19.7

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
  SHA256:
3
- metadata.gz: 6654ed357cf14e1ab2a0a9c1781dca9904ed18e4e9690fb12391442827c2e5b9
4
- data.tar.gz: c56f38923aec8ff5093c52dda68b0cd7655c1290d9ddb3fe13fc380ee122d9a6
3
+ metadata.gz: 255770dfd71b03dfd82eb6d6cfd9710a77fc0dab5e46f744b2a544058ef497c1
4
+ data.tar.gz: 9914dce97923f334dff7dcead5e9037135eed26d0d4c31e96a8d632f211a5699
5
5
  SHA512:
6
- metadata.gz: bdcef3ff2f3f9fd156e9b1f365a9bb4a89da8f64cfe03e6780ea8f4aefe57390662ddca0c2d5efef756006ea031543c720012e94c51bdbb96a6e9bdaa07967d4
7
- data.tar.gz: fd2f4a3c15ea00891a31fd94c233ebcb772fdd9c9e41505a9f7bcec765b1c60ffd73034c9bb9f1866f86bbdad046ac72ec3da4b53280c6506194d1a4955b3f4f
6
+ metadata.gz: 54eaf26dc7f4f01f05206af204cd44b737b8b87c2a486afd18b0c4b1593420e26ef4dc38c74fdef8825ca6e62e7ecc9ce271ccb37aeef4e68bb363642f26ed04
7
+ data.tar.gz: 6cee7c2c9776dcbbf96c8868837682870a575a6ccb86831a4afad1f1ea2a88d55d47b44e113819a9d6976c53f6f1a829bcece881fdcafcb22f6a9b2d35a852a7
@@ -6,7 +6,7 @@ require_relative "mods_parser"
6
6
 
7
7
  module RelatonNist
8
8
  class DataFetcher
9
- URL = "https://github.com/usnistgov/NIST-Tech-Pubs/releases/download/Oct2024/allrecords-MODS.xml"
9
+ URL = "https://github.com/usnistgov/NIST-Tech-Pubs/releases/download/Nov2024/allrecords-MODS.xml"
10
10
 
11
11
  def initialize(output, format)
12
12
  @output = output
@@ -57,21 +57,12 @@ module RelatonNist
57
57
  #
58
58
  # @return [Array<RelatonNist::Hit>] hits
59
59
  #
60
- def search_filter # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
60
+ def search_filter
61
61
  refid = ::Pubid::Nist::Identifier.parse(@reference)
62
+ parts = exclude_parts refid
62
63
  arr = @array.select do |item|
63
64
  pubid = ::Pubid::Nist::Identifier.parse(item.hit[:code].sub(/\.$/, ""))
64
- pubid == refid
65
- # parts = doi_parts(item.hit[:json]) || code_parts(item.hit[:code])
66
- # iteration = item.hit.dig(:json, "iteration")
67
- # draft = parts[:draft] || (!iteration.nil? && iteration.match?(/\wpd/i))
68
- # refparts[:code] && [parts[:series], item.hit[:series]].include?(refparts[:series]) &&
69
- # refparts[:code].casecmp(parts[:code].upcase).zero? &&
70
- # refparts[:prt] == parts[:prt] &&
71
- # (refparts[:vol].nil? || refparts[:vol] == parts[:vol]) &&
72
- # (refparts[:ver].nil? || refparts[:ver] == parts[:ver]) &&
73
- # (refparts[:rev].nil? || refparts[:rev] == parts[:rev]) &&
74
- # refparts[:draft] == draft && refparts[:add] == parts[:add]
65
+ pubid.exclude(*parts) == refid
75
66
  rescue StandardError
76
67
  item.hit[:code] == text
77
68
  end
@@ -83,6 +74,12 @@ module RelatonNist
83
74
  return dup
84
75
  end
85
76
 
77
+ def exclude_parts(pubid)
78
+ %i[stage update].each_with_object([]) do |part, parts|
79
+ parts << part if pubid.send(part).nil?
80
+ end
81
+ end
82
+
86
83
  private
87
84
 
88
85
  def code_parts(code) # rubocop:disable Metrics/MethodLength
@@ -252,8 +249,6 @@ module RelatonNist
252
249
  else
253
250
  json["docidentifier"]
254
251
  end => id
255
- # parts = doi_parts(json) || code_parts(json["docidentifier"])
256
- # return json["docidentifier"] unless parts
257
252
 
258
253
  id.sub!(/(?:-draft\d*|\.\wpd)$/, "")
259
254
  pid = ::Pubid::Nist::Identifier.parse(id)
@@ -265,20 +260,13 @@ module RelatonNist
265
260
  when /(\w)pd/
266
261
  pid.stage = ::Pubid::Nist::Stage.new id: Regexp.last_match(1), type: "pd"
267
262
  end
263
+
264
+ /\/upd(?<upd>\d+)\// =~ json["uri"]
265
+ pid.update = Pubid::Nist::Update.new number: upd if upd
268
266
  pid.to_s
269
267
  rescue StandardError
270
268
  id += " #{json["iteration"].sub('final', 'fpd')}" if json["iteration"]
271
269
  id
272
-
273
- # id = parts[:code]
274
- # id = "NIST #{parts[:series]} #{id}" if parts[:series]
275
- # id += " Part #{parts[:prt]}" if parts[:prt]
276
- # id += " Vol. #{parts[:vol]}" if parts[:vol]
277
- # id += " Ver. #{parts[:ver]}" if parts[:ver]
278
- # id += " Rev. #{parts[:rev]}" if parts[:rev]
279
- # id += "-Add" if parts[:add]
280
- # id += " (Draft)" if parts[:draft] || @opts[:stage]
281
- # id
282
270
  end
283
271
 
284
272
  #
@@ -1,3 +1,3 @@
1
1
  module RelatonNist
2
- VERSION = "1.19.6".freeze
2
+ VERSION = "1.19.7".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.19.6
4
+ version: 1.19.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-20 00:00:00.000000000 Z
11
+ date: 2024-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -142,7 +142,7 @@ homepage: https://github.com/metanorma/relaton-nist
142
142
  licenses:
143
143
  - MIT
144
144
  metadata: {}
145
- post_install_message:
145
+ post_install_message:
146
146
  rdoc_options: []
147
147
  require_paths:
148
148
  - lib
@@ -157,8 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.3.27
161
- signing_key:
160
+ rubygems_version: 3.5.19
161
+ signing_key:
162
162
  specification_version: 4
163
163
  summary: 'RelatonNist: retrive NIST standards.'
164
164
  test_files: []