relaton 1.18.0 → 1.18.2

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: b7c5f3e470692974347ac474f45af281a5bb14f7733d9cbbfc21797cde40da60
4
- data.tar.gz: 723005aeb2717a6f90ef1bb017e5aae78076d69f038711878dc39624c1f5fdf7
3
+ metadata.gz: e166e4b98b190a6286f8d6ea532e65977a901c2ff5a7f1e26f1ca1412ab92230
4
+ data.tar.gz: c07830c2b5f15bef3190b1ea07916731e8befeb9c224c6a1f4749872d8b73285
5
5
  SHA512:
6
- metadata.gz: 747a70cc7e9d36ee839be8faa61b68b7fcc9085b01de70237ff132b04a2fd3b665be5256d2387fc308517171db7f23ec4d4015035fef2694a8472ce493e99117
7
- data.tar.gz: cc2db525a28fa3711e409c61f3292206ae7626976519ce86ec3a69a9fa510649aa2a88c9750f2cc24276b7bc60eb35602d4826b630f1d122d26cdd576d4f6a34
6
+ metadata.gz: bb61c2add854d65c4113a0130f4ddd562b1bb73aa564897c665334d56dcf7645ad2a22f73a5b081a403e0ea522b22780c0a1ec9fed81905cbc5eee47ca40824e
7
+ data.tar.gz: 53633d5bde382e7c57c2af957a1b60b1dbb82fa89cd64d341271b5330c8f634cf8bd3b38527e721fc6ceae8f64fc165bfeb1ef99fb42480ad7cf47c59111ea6c
data/.rubocop.yml CHANGED
@@ -7,6 +7,6 @@ require: rubocop-rails
7
7
  inherit_from:
8
8
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
9
  AllCops:
10
- TargetRubyVersion: 2.7
10
+ TargetRubyVersion: 3.0
11
11
  Rails:
12
12
  Enabled: false
data/lib/relaton/db.rb CHANGED
@@ -447,15 +447,26 @@ module Relaton
447
447
  bib = net_retry(code, year, opts, processor, opts.fetch(:retries, 1))
448
448
 
449
449
  entry = check_entry(bib, stdclass, **args)
450
- return entry if args[:db].nil? || args[:id].nil?
450
+ return entry if args[:db].nil?
451
451
 
452
452
  @semaphore.synchronize { args[:db][args[:id]] ||= entry }
453
+ args[:no_cache] ? bib_entry(bib) : entry
453
454
  end
454
455
 
456
+ #
457
+ # If the reference isn't equal to the document identifier
458
+ # then store the document in the cache and create for the reference a redirection to the document
459
+ #
460
+ # @param [<Type>] bib <description>
461
+ # @param [<Type>] stdclass <description>
462
+ # @param [<Type>] **args <description>
463
+ #
464
+ # @return [<Type>] <description>
465
+ #
455
466
  def check_entry(bib, stdclass, **args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
456
467
  bib_id = bib&.docidentifier&.first&.id
457
468
 
458
- # when docid doesn't match bib's id then return a reference to bib's id
469
+ # when ref isn't equal to bib's id then return a redirection to bib's id
459
470
  if args[:db] && args[:id] && bib_id && args[:id] !~ %r{#{Regexp.quote("(#{bib_id})")}}
460
471
  bid = std_id(bib.docidentifier.first.id, nil, {}, stdclass).first
461
472
  @semaphore.synchronize { args[:db][bid] ||= bib_entry bib }
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "1.18.0".freeze
2
+ VERSION = "1.18.2".freeze
3
3
  end
data/relaton.gemspec CHANGED
@@ -27,11 +27,11 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.files = `git ls-files`.split("\n")
29
29
  # spec.test_files = `git ls-files -- {spec}/*`.split("\n")
30
- spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
30
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.0.0")
31
31
 
32
32
  spec.add_dependency "relaton-3gpp", "~> 1.18.0"
33
33
  spec.add_dependency "relaton-bipm", "~> 1.18.0"
34
- spec.add_dependency "relaton-bsi", "~> 1.18.0"
34
+ spec.add_dependency "relaton-bsi", "~> 1.18.1"
35
35
  spec.add_dependency "relaton-calconnect", "~> 1.18.0"
36
36
  spec.add_dependency "relaton-ccsds", "~> 1.18.0"
37
37
  spec.add_dependency "relaton-cen", "~> 1.18.0"
@@ -39,14 +39,14 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency "relaton-doi", "~> 1.18.0"
40
40
  spec.add_dependency "relaton-ecma", "~> 1.18.0"
41
41
  spec.add_dependency "relaton-etsi", "~> 1.18.0"
42
- spec.add_dependency "relaton-gb", "~> 1.18.0"
42
+ spec.add_dependency "relaton-gb", "~> 1.18.2"
43
43
  spec.add_dependency "relaton-iana", "~> 1.18.0"
44
44
  spec.add_dependency "relaton-iec", "~> 1.18.0"
45
45
  spec.add_dependency "relaton-ieee", "~> 1.18.0"
46
46
  spec.add_dependency "relaton-ietf", "~> 1.18.0"
47
47
  spec.add_dependency "relaton-iho", "~> 1.18.0"
48
48
  spec.add_dependency "relaton-isbn", "~> 1.18.0"
49
- spec.add_dependency "relaton-iso", "~> 1.18.0"
49
+ spec.add_dependency "relaton-iso", "~> 1.18.4"
50
50
  spec.add_dependency "relaton-itu", "~> 1.18.0"
51
51
  spec.add_dependency "relaton-jis", "~> 1.18.0"
52
52
  spec.add_dependency "relaton-nist", "~> 1.18.0"
@@ -50,6 +50,38 @@ RSpec.describe Relaton::Db do
50
50
  expect(subject.send(:combine_doc, code, nil, {}, :relaton_bipm)).to be_nil
51
51
  end
52
52
  end
53
+
54
+ context "#fetch_entry" do
55
+ let(:db_cache) { double "db_cache" }
56
+
57
+ before do
58
+ expect(subject).to receive(:net_retry).with("ISO 123", nil, {}, kind_of(RelatonIso::Processor), 1).and_return :bib
59
+ end
60
+
61
+ it "using cache" do
62
+ expect(db_cache).to receive(:[]).with("ISO(ISO 123)").and_return nil
63
+ expect(db_cache).to receive(:[]=).with("ISO(ISO 123)", :entry)
64
+ expect(subject).to receive(:check_entry).with(:bib, :relaton_iso, db: db_cache, id: "ISO(ISO 123)").and_return :entry
65
+ entry = subject.send :fetch_entry, "ISO 123", nil, {}, :relaton_iso, db: db_cache, id: "ISO(ISO 123)"
66
+ expect(entry).to be :entry
67
+ end
68
+
69
+ it "DbCache is undefined" do
70
+ expect(subject).to receive(:check_entry).with(:bib, :relaton_iso, **{}).and_return :entry
71
+ entry = subject.send :fetch_entry, "ISO 123", nil, {}, :relaton_iso
72
+ expect(entry).to be :entry
73
+ end
74
+
75
+ it "not using cache" do
76
+ expect(subject).to receive(:bib_entry).with(:bib).and_return :entry
77
+ expect(subject).to receive(:check_entry).with(
78
+ :bib, :relaton_iso, db: db_cache, id: "ISO(ISO 123)", no_cache: true
79
+ ).and_return :entry
80
+ expect(db_cache).to receive(:[]).with("ISO(ISO 123)").and_return :entry
81
+ entry = subject.send :fetch_entry, "ISO 123", nil, {}, :relaton_iso, db: db_cache, id: "ISO(ISO 123)", no_cache: true
82
+ expect(entry).to be :entry
83
+ end
84
+ end
53
85
  end
54
86
 
55
87
  context "class methods" do
data/spec/relaton_spec.rb CHANGED
@@ -228,14 +228,14 @@ RSpec.describe Relaton::Db do
228
228
  end
229
229
  end
230
230
 
231
- it "get UN reference" do
232
- docid = RelatonBib::DocumentIdentifier.new(id: "UN TRADE/CEFACT/2004/32", type: "UN")
233
- item = RelatonUn::UnBibliographicItem.new docid: [docid], session: RelatonUn::Session.new(session_number: "1")
234
- expect(RelatonUn::UnBibliography).to receive(:get).with("UN TRADE/CEFACT/2004/32", nil, {}).and_return item
235
- bib = @db.fetch "UN TRADE/CEFACT/2004/32", nil, {}
236
- expect(bib).to be_instance_of RelatonUn::UnBibliographicItem
237
- expect(bib.docidentifier.first.id).to eq "UN TRADE/CEFACT/2004/32"
238
- end
231
+ # it "get UN reference" do
232
+ # docid = RelatonBib::DocumentIdentifier.new(id: "UN TRADE/CEFACT/2004/32", type: "UN")
233
+ # item = RelatonUn::UnBibliographicItem.new docid: [docid], session: RelatonUn::Session.new(session_number: "1")
234
+ # expect(RelatonUn::UnBibliography).to receive(:get).with("UN TRADE/CEFACT/2004/32", nil, {}).and_return item
235
+ # bib = @db.fetch "UN TRADE/CEFACT/2004/32", nil, {}
236
+ # expect(bib).to be_instance_of RelatonUn::UnBibliographicItem
237
+ # expect(bib.docidentifier.first.id).to eq "UN TRADE/CEFACT/2004/32"
238
+ # end
239
239
 
240
240
  it "get W3C reference" do
241
241
  docid = RelatonBib::DocumentIdentifier.new(id: "W3C REC-json-ld11-20200716", type: "W3C")
@@ -383,7 +383,7 @@ RSpec.describe Relaton::Db do
383
383
  expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014"
384
384
  expect(bib.relation[1].type).to eq "derivedFrom"
385
385
  expect(bib.relation[1].description).to be_nil
386
- expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014/Amd 1"
386
+ expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014/Amd 1:2018"
387
387
  end
388
388
  end
389
389
 
@@ -395,7 +395,7 @@ RSpec.describe Relaton::Db do
395
395
  expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014"
396
396
  expect(bib.relation[1].type).to eq "complements"
397
397
  expect(bib.relation[1].description.content).to eq "amendment"
398
- expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014/Amd 1"
398
+ expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014/Amd 1:2018"
399
399
  end
400
400
  end
401
401
  end
@@ -39,21 +39,21 @@ http_interactions:
39
39
  X-Xss-Protection:
40
40
  - 1; mode=block
41
41
  X-Github-Request-Id:
42
- - E384:10E5:26C1F3:300C4F:6594DF80
42
+ - 32B7:2EA234:11492F5:13552C6:6661CFCA
43
43
  Accept-Ranges:
44
44
  - bytes
45
45
  Date:
46
- - Wed, 03 Jan 2024 05:06:32 GMT
46
+ - Thu, 06 Jun 2024 15:03:39 GMT
47
47
  Via:
48
48
  - 1.1 varnish
49
49
  X-Served-By:
50
- - cache-pdk-kpdk1780127-PDK
50
+ - cache-pdk-katl1840035-PDK
51
51
  X-Cache:
52
- - HIT
52
+ - MISS
53
53
  X-Cache-Hits:
54
- - '1'
54
+ - '0'
55
55
  X-Timer:
56
- - S1704258392.124397,VS0,VE189
56
+ - S1717686219.289272,VS0,VE217
57
57
  Vary:
58
58
  - Authorization,Accept-Encoding,Origin
59
59
  Access-Control-Allow-Origin:
@@ -61,9 +61,9 @@ http_interactions:
61
61
  Cross-Origin-Resource-Policy:
62
62
  - cross-origin
63
63
  X-Fastly-Request-Id:
64
- - 515ab9c3fc71f9d2e8c83836ff2293a364056a68
64
+ - '0476792df737acd69880ee6be6c6f6e231ef9e5d'
65
65
  Expires:
66
- - Wed, 03 Jan 2024 05:11:32 GMT
66
+ - Thu, 06 Jun 2024 15:08:39 GMT
67
67
  Source-Age:
68
68
  - '0'
69
69
  body:
@@ -11299,7 +11299,7 @@ http_interactions:
11299
11299
  HgMUAAAACAA6cm9XZto2RTS1BwAWXlAADQAYAAAAAAABAAAApIEAAAAAaW5k
11300
11300
  ZXgtdjEueWFtbFVUBQADENNUZXV4CwABBOkDAAAEfwAAAFBLBQYAAAAAAQAB
11301
11301
  AFMAAAB7tQcAAAA=
11302
- recorded_at: Wed, 03 Jan 2024 05:06:32 GMT
11302
+ recorded_at: Thu, 06 Jun 2024 15:03:39 GMT
11303
11303
  - request:
11304
11304
  method: get
11305
11305
  uri: https://raw.githubusercontent.com/relaton/relaton-data-3gpp/main/data/TR_00.01U_UMTS_3.0.0.yaml
@@ -11313,6 +11313,8 @@ http_interactions:
11313
11313
  - "*/*"
11314
11314
  User-Agent:
11315
11315
  - Ruby
11316
+ Host:
11317
+ - raw.githubusercontent.com
11316
11318
  response:
11317
11319
  status:
11318
11320
  code: 200
@@ -11339,21 +11341,21 @@ http_interactions:
11339
11341
  X-Xss-Protection:
11340
11342
  - 1; mode=block
11341
11343
  X-Github-Request-Id:
11342
- - EAD6:093D:1A0A6A9:1FA171A:6594DF83
11344
+ - 74E0:618D9:438D9D:4BDD0F:6661CFCF
11343
11345
  Accept-Ranges:
11344
11346
  - bytes
11345
11347
  Date:
11346
- - Wed, 03 Jan 2024 05:06:34 GMT
11348
+ - Thu, 06 Jun 2024 15:03:43 GMT
11347
11349
  Via:
11348
11350
  - 1.1 varnish
11349
11351
  X-Served-By:
11350
- - cache-pdk-kpdk1780147-PDK
11352
+ - cache-pdk-katl1840058-PDK
11351
11353
  X-Cache:
11352
- - HIT
11354
+ - MISS
11353
11355
  X-Cache-Hits:
11354
- - '1'
11356
+ - '0'
11355
11357
  X-Timer:
11356
- - S1704258395.643601,VS0,VE123
11358
+ - S1717686224.653209,VS0,VE140
11357
11359
  Vary:
11358
11360
  - Authorization,Accept-Encoding,Origin
11359
11361
  Access-Control-Allow-Origin:
@@ -11361,9 +11363,9 @@ http_interactions:
11361
11363
  Cross-Origin-Resource-Policy:
11362
11364
  - cross-origin
11363
11365
  X-Fastly-Request-Id:
11364
- - 041b74d548b24ba1e9e799133bd9b47c2dbb25ee
11366
+ - e8aa88a118b77ebf245340bf762a283d74465747
11365
11367
  Expires:
11366
- - Wed, 03 Jan 2024 05:11:34 GMT
11368
+ - Thu, 06 Jun 2024 15:08:43 GMT
11367
11369
  Source-Age:
11368
11370
  - '0'
11369
11371
  body:
@@ -11404,5 +11406,5 @@ http_interactions:
11404
11406
  bWVldGluZzogU01HLTI4CiAgZnJlZXplX3N0YWdlMl9tZWV0aW5nOiBTTUct
11405
11407
  MjgKICBmcmVlemVfc3RhZ2UzX21lZXRpbmc6IFNNRy0yOAogIGNsb3NlX21l
11406
11408
  ZXRpbmc6IFNQLTI4CiAgcHJvamVjdF9lbmQ6ICcxOTk5LTAyLTEyJwo=
11407
- recorded_at: Wed, 03 Jan 2024 05:06:34 GMT
11409
+ recorded_at: Thu, 06 Jun 2024 15:03:43 GMT
11408
11410
  recorded_with: VCR 6.2.0
@@ -27,27 +27,27 @@ http_interactions:
27
27
  Connection:
28
28
  - keep-alive
29
29
  Date:
30
- - Wed, 03 Jan 2024 05:08:07 GMT
30
+ - Thu, 06 Jun 2024 15:04:59 GMT
31
31
  X-Amzn-Requestid:
32
- - 80e58fa0-ad1f-4773-9cde-a4478a0ce3fa
32
+ - 1df9b3d6-61e3-436e-b183-9fb15fea30cb
33
33
  Access-Control-Allow-Origin:
34
34
  - "*"
35
35
  Access-Control-Allow-Headers:
36
36
  - Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token
37
37
  X-Amz-Apigw-Id:
38
- - Q8nCYGacIAMEIXw=
38
+ - Y81xqGeQIAMEbnw=
39
39
  Access-Control-Allow-Methods:
40
40
  - GET, POST, OPTIONS
41
41
  X-Amzn-Trace-Id:
42
- - Root=1-6594eba8-691cf3bf1aa69aee7753ded0;Sampled=0;lineage=521d48d5:0
42
+ - Root=1-6661d00a-65f629d973f707461427daa4;Parent=2b510a4a08620796;Sampled=0;lineage=521d48d5:0
43
43
  X-Cache:
44
44
  - Miss from cloudfront
45
45
  Via:
46
- - 1.1 af4b82f24e15a32a618ba4f9be9cbf92.cloudfront.net (CloudFront)
46
+ - 1.1 4b4ef7cefd8f81a1e60437d0590406b8.cloudfront.net (CloudFront)
47
47
  X-Amz-Cf-Pop:
48
- - ATL51-C1
48
+ - ATL59-P4
49
49
  X-Amz-Cf-Id:
50
- - x-w2RC78CvvzOXbsFysTkVO6p_jVVVBm1UEC07jHP0mcyzRkDRP0-Q==
50
+ - u-ZD8u9MreGWb0NebHDZUzWoQVJ3j3wo6jtUzeW4mwpdUIZ6I8rrig==
51
51
  body:
52
52
  encoding: UTF-8
53
53
  base64_string: |
@@ -117,5 +117,5 @@ http_interactions:
117
117
  dHJ1Y3R1cmVkaWRlbnRpZmllciB0eXBlPSJJU08iPgogICAgICA8cHJvamVj
118
118
  dC1udW1iZXI+SVNPIDE5MTE1PC9wcm9qZWN0LW51bWJlcj4KICAgIDwvc3Ry
119
119
  dWN0dXJlZGlkZW50aWZpZXI+CiAgPC9leHQ+CjwvYmliZGF0YT4=
120
- recorded_at: Wed, 03 Jan 2024 05:08:07 GMT
120
+ recorded_at: Thu, 06 Jun 2024 15:04:59 GMT
121
121
  recorded_with: VCR 6.2.0