relaton 1.14.2 → 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/docs/README.adoc +1 -3
  3. data/lib/relaton/db.rb +1 -1
  4. data/lib/relaton/registry.rb +1 -1
  5. data/lib/relaton/version.rb +1 -1
  6. data/relaton.gemspec +2 -1
  7. data/spec/relaton/db_spec.rb +14 -20
  8. data/spec/relaton/registry_spec.rb +4 -0
  9. data/spec/relaton_spec.rb +147 -118
  10. data/spec/spec_helper.rb +1 -1
  11. data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +16 -14
  12. data/spec/vcr_cassetes/api_relaton_org.yml +80 -10
  13. data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +18 -18
  14. data/spec/vcr_cassetes/bsi_bs_en_iso_8848.yml +34 -34
  15. data/spec/vcr_cassetes/cc_dir_10005_2019.yml +2310 -13
  16. data/spec/vcr_cassetes/cie_001_1980.yml +15 -13
  17. data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +9 -9
  18. data/spec/vcr_cassetes/ecma_6.yml +13 -12
  19. data/spec/vcr_cassetes/en_10160_1999.yml +6821 -34
  20. data/spec/vcr_cassetes/iana_service_names_port_numbers.yml +13 -10
  21. data/spec/vcr_cassetes/ieee_528_2019.yml +11 -11
  22. data/spec/vcr_cassetes/iso_111111119115_1.yml +10 -10
  23. data/spec/vcr_cassetes/iso_19115_1.yml +17 -17
  24. data/spec/vcr_cassetes/iso_19115_1_2.yml +34 -34
  25. data/spec/vcr_cassetes/iso_19115_all_parts.yml +18 -18
  26. data/spec/vcr_cassetes/iso_19133_2005.yml +16 -16
  27. data/spec/vcr_cassetes/iso_combined_applied.yml +34 -34
  28. data/spec/vcr_cassetes/iso_combined_included.yml +35 -35
  29. data/spec/vcr_cassetes/iso_dis.yml +17 -17
  30. data/spec/vcr_cassetes/ogc_19_025r1.yml +11 -11
  31. data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +6 -6
  32. data/spec/vcr_cassetes/rfc_8341.yml +21 -9
  33. metadata +17 -17
  34. data/spec/vcr_cassetes/async_fetch.yml +0 -4457
  35. data/spec/vcr_cassetes/bipm_i18n_async_fetch.yml +0 -414
  36. data/spec/vcr_cassetes/bipm_metrologia_29_6_373.yml +0 -294
  37. data/spec/vcr_cassetes/fisp_140.yml +0 -48
  38. data/spec/vcr_cassetes/gb_t_20223_2006.yml +0 -147
  39. data/spec/vcr_cassetes/iec_60050_102_2007.yml +0 -280
  40. data/spec/vcr_cassetes/iec_combined_included.yml +0 -926
  41. data/spec/vcr_cassetes/iho_b_11.yml +0 -74
  42. data/spec/vcr_cassetes/itu_combined_included.yml +0 -1333
  43. data/spec/vcr_cassetes/oasis_amqp_core_types_v1_0_pt1.yml +0 -84
  44. data/spec/vcr_cassetes/sp_800_38b.yml +0 -48
  45. data/spec/vcr_cassetes/threads_from_env.yml +0 -412
  46. data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +0 -814
  47. data/spec/vcr_cassetes/w3c_json_ld11.yml +0 -232
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba19ef4231f91cd1c73a0a12ea6b94767c806ea8e2cd1f3189417b8516885815
4
- data.tar.gz: 3d31d937b29d24a7bbd9edd8ecd481d87b9f913e1083afe761c36ef8d986bf4d
3
+ metadata.gz: 92d8d26812ae600e09e7b84beb548768db73c0e0837389feb0cf55c84ec4314f
4
+ data.tar.gz: d7737f947638fbe5eb17456c2e41e0b1b567434db39cbbc2f0c1644378765c9a
5
5
  SHA512:
6
- metadata.gz: c578292b8a0fc0f943e8e881bcaba046b38d9042b9ab6213748e1bf627296ae950ecfb7e9486612cfb8ae24659d7416fcb5fe6c2a305eecdf2b6dcab748d73b8
7
- data.tar.gz: 38c2a08b85107d690507fd09ed674276e493d95ffcaba9bef7454a9a7338f848d9c971d46be6cc4256b8317c5d67125360946cd5ee352b845ff92c1cd28a4861
6
+ metadata.gz: 94b13ec45ed1b2f2313212ec1eecd5e25f60cf5017874f342100a2702b141cbb0f09bc275b34ccc1f5afbc6bbfd66f89d19febda44828f7e1f33046ee5c18fce
7
+ data.tar.gz: bc7c20aa21f7c7552a6cc191cce868786949939b7f66c939f69f825b887da48233ed2bde348e837c4388e37164d858edcd6e06702376063d690086872f8011e9
data/docs/README.adoc CHANGED
@@ -1,9 +1,7 @@
1
1
  = Relaton
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton.svg["Gem Version", link="https://rubygems.org/gems/relaton"]
4
- image:https://github.com/relaton/relaton/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton/actions?workflow=macos"]
5
- image:https://github.com/relaton/relaton/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton/actions?workflow=windows"]
6
- image:https://github.com/relaton/relaton/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton/actions?workflow=ubuntu"]
4
+ image:https://github.com/relaton/relaton/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton/actions?workflow=rake"]
7
5
  image:https://codeclimate.com/github/relaton/relaton/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton"]
8
6
  image:https://img.shields.io/github/issues-pr-raw/relaton/relaton.svg["Pull Requests", link="https://github.com/relaton/relaton/pulls"]
9
7
  image:https://img.shields.io/github/commits-since/relaton/relaton/latest.svg["Commits since latest",link="https://github.com/relaton/relaton/releases"]
data/lib/relaton/db.rb CHANGED
@@ -110,7 +110,7 @@ module Relaton
110
110
  Util.log "[relaton] ERROR: #{args[0]} -- #{e.message}", :error
111
111
  args[3].call nil
112
112
  end
113
- @queues[stdclass] = { queue: Queue.new, workers_pool: wp }
113
+ @queues[stdclass] = { queue: SizedQueue.new(threads * 2), workers_pool: wp }
114
114
  Thread.new { process_queue @queues[stdclass] }
115
115
  end
116
116
  @queues[stdclass][:queue] << [ref, year, opts, block]
@@ -9,7 +9,7 @@ module Relaton
9
9
  relaton_gb relaton_iec relaton_ietf relaton_iso relaton_itu relaton_nist
10
10
  relaton_ogc relaton_calconnect relaton_omg relaton_un relaton_w3c
11
11
  relaton_ieee relaton_iho relaton_bipm relaton_ecma relaton_cie relaton_bsi
12
- relaton_cen relaton_iana relaton_3gpp relaton_oasis relaton_doi
12
+ relaton_cen relaton_iana relaton_3gpp relaton_oasis relaton_doi relaton_jis
13
13
  ].freeze
14
14
 
15
15
  include Singleton
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "1.14.2".freeze
2
+ VERSION = "1.15.1".freeze
3
3
  end
data/relaton.gemspec CHANGED
@@ -43,8 +43,9 @@ Gem::Specification.new do |spec|
43
43
  spec.add_dependency "relaton-ieee", "~> 1.14.0"
44
44
  spec.add_dependency "relaton-ietf", "~> 1.14.0"
45
45
  spec.add_dependency "relaton-iho", "~> 1.14.0"
46
- spec.add_dependency "relaton-iso", "~> 1.14.0"
46
+ spec.add_dependency "relaton-iso", "~> 1.15.0"
47
47
  spec.add_dependency "relaton-itu", "~> 1.14.0"
48
+ spec.add_dependency "relaton-jis", "~> 1.14.0"
48
49
  spec.add_dependency "relaton-nist", "~> 1.14.0"
49
50
  spec.add_dependency "relaton-oasis", "~> 1.14.0"
50
51
  spec.add_dependency "relaton-ogc", "~> 1.14.0"
@@ -8,6 +8,7 @@ RSpec.describe Relaton::Db do
8
8
  it "create bibitem from YAML content" do
9
9
  h = { "docid" => [{ "id" => "ISO 123", type: "ISO", "primary" => true }] }
10
10
  expect(YAML).to receive(:safe_load).with(:content).and_return h
11
+ allow(YAML).to receive(:safe_load).and_call_original
11
12
  item = subject.send :search_edition_year, "iso/item.yaml", :content, nil, nil
12
13
  expect(item).to be_instance_of RelatonIsoBib::IsoBibliographicItem
13
14
  end
@@ -203,33 +204,27 @@ RSpec.describe Relaton::Db do
203
204
  "ITU-T Y.1911", "ITU-T Y.2012", "ITU-T Y.2206", "ITU-T O.172",
204
205
  "ITU-T G.780/Y.1351", "ITU-T G.711", "ITU-T G.1011"]
205
206
  results = []
206
- VCR.use_cassette "async_fetch", match_requests_on: %i[method uri body] do
207
- refs.each do |ref|
208
- db.fetch_async(ref) { |r| queue << [r, ref] }
209
- end
210
- Timeout.timeout(60) { refs.size.times { results << queue.pop } }
207
+ refs.each do |ref|
208
+ expect(db).to receive(:fetch).with(ref, nil, {}).and_return :result
209
+ db.fetch_async(ref) { |r| queue << [r, ref] }
211
210
  end
211
+ Timeout.timeout(60) { refs.size.times { results << queue.pop } }
212
212
  results.each do |result|
213
- expect(result[0]).to be_instance_of RelatonItu::ItuBibliographicItem
213
+ expect(result[0]).to be :result
214
214
  end
215
215
  end
216
216
 
217
217
  it "BIPM i18n" do
218
- expect(File).to receive(:exist?).with(/index\.yaml/).and_return false
219
- allow(File).to receive(:exist?).and_call_original
220
- # refs = ["CGPM Resolution 1889-00", "CGPM Résolution 1889-00",
221
- # "CGPM Réunion 9", "CGPM Meeting 9"]
222
218
  refs = ["CGPM -- Resolution (1889)", "CGPM -- Résolution (1889)",
223
219
  "CGPM -- Réunion 9 (1948)", "CGPM -- Meeting 9 (1948)"]
224
220
  results = []
225
- VCR.use_cassette "bipm_i18n_async_fetch", match_requests_on: %i[method uri body] do
226
- refs.each do |ref|
227
- db.fetch_async(ref) { |r| queue << [r, ref] }
228
- end
229
- Timeout.timeout(60) { refs.size.times { results << queue.pop } }
221
+ refs.each do |ref|
222
+ expect(db).to receive(:fetch).with(ref, nil, {}).and_return :result
223
+ db.fetch_async(ref) { |r| queue << [r, ref] }
230
224
  end
225
+ Timeout.timeout(60) { refs.size.times { results << queue.pop } }
231
226
  results.each do |result|
232
- expect(result[0]).to be_instance_of RelatonBipm::BipmBibliographicItem
227
+ expect(result[0]).to be :result
233
228
  end
234
229
  end
235
230
 
@@ -262,10 +257,9 @@ RSpec.describe Relaton::Db do
262
257
  expect(ENV).to receive(:[]).with("RELATON_FETCH_PARALLEL").and_return(1)
263
258
  allow(ENV).to receive(:[]).and_call_original
264
259
  expect(Relaton::WorkersPool).to receive(:new).with(1).and_call_original
265
- VCR.use_cassette "threads_from_env" do
266
- db.fetch_async("ITU-T G.993.5") { |r| queue << r }
267
- Timeout.timeout(50) { queue.pop }
268
- end
260
+ expect(db).to receive(:fetch).with("ITU-T G.993.5", nil, {})
261
+ db.fetch_async("ITU-T G.993.5") { |r| queue << r }
262
+ Timeout.timeout(50) { queue.pop }
269
263
  end
270
264
  end
271
265
  end
@@ -105,6 +105,10 @@ RSpec.describe Relaton::Registry do
105
105
  expect(Relaton::Registry.instance.by_type("DOI")).to be_instance_of RelatonDoi::Processor
106
106
  expect(Relaton::Registry.instance.processor_by_ref("doi:10.1000/182")).to be_instance_of RelatonDoi::Processor
107
107
  end
108
+
109
+ it "JIS" do
110
+ expect(Relaton::Registry.instance.by_type("JIS")).to be_instance_of RelatonJis::Processor
111
+ end
108
112
  end
109
113
 
110
114
  it "find processot by dataset" do
data/spec/relaton_spec.rb CHANGED
@@ -68,41 +68,40 @@ RSpec.describe Relaton::Db do
68
68
  end
69
69
 
70
70
  context "IEC" do
71
+ before do
72
+ docid = RelatonBib::DocumentIdentifier.new(id: "IEC 60050-102:2007", type: "IEC")
73
+ item = RelatonIec::IecBibliographicItem.new docid: [docid]
74
+ expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60050-102:2007", nil, {}).and_return item
75
+ end
76
+
71
77
  it "get by reference" do
72
- VCR.use_cassette "iec_60050_102_2007" do
73
- bib = @db.fetch "IEC 60050-102:2007"
74
- expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
75
- end
78
+ bib = @db.fetch "IEC 60050-102:2007"
79
+ expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
76
80
  end
77
81
 
78
82
  it "get by URN" do
79
- VCR.use_cassette "iec_60050_102_2007" do
80
- bib = @db.fetch "urn:iec:std:iec:60050-102:2007:::"
81
- expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
82
- end
83
+ bib = @db.fetch "urn:iec:std:iec:60050-102:2007:::"
84
+ expect(bib.docidentifier[0].id).to eq "IEC 60050-102:2007"
83
85
  end
84
86
  end
85
87
 
86
88
  context "NIST references" do
87
- before(:each) do
88
- nist_fr = /\.relaton\/nist\/pubs-export\.zip/
89
- expect(File).to receive(:exist?).with(nist_fr).and_return false
90
- expect(File).to receive(:exist?).and_call_original.at_least :once
91
- # expect(FileUtils).to receive(:mv).with kind_of(String), nist_fr
92
- end
93
-
94
89
  it "gets FISP" do
95
- VCR.use_cassette "fisp_140" do
96
- bib = @db.fetch "NIST FIPS 140"
97
- expect(bib).to be_instance_of RelatonNist::NistBibliographicItem
98
- end
90
+ docid = RelatonBib::DocumentIdentifier.new(id: "NIST FIPS 140", type: "NIST")
91
+ item = RelatonNist::NistBibliographicItem.new docid: [docid]
92
+ expect(RelatonNist::NistBibliography).to receive(:get).with("NIST FIPS 140", nil, {}).and_return item
93
+ bib = @db.fetch "NIST FIPS 140"
94
+ expect(bib).to be_instance_of RelatonNist::NistBibliographicItem
95
+ expect(bib.docidentifier[0].id).to eq "NIST FIPS 140"
99
96
  end
100
97
 
101
98
  it "gets SP" do
102
- VCR.use_cassette "sp_800_38b" do
103
- bib = @db.fetch "NIST SP 800-38B"
104
- expect(bib).to be_instance_of RelatonNist::NistBibliographicItem
105
- end
99
+ docid = RelatonBib::DocumentIdentifier.new(id: "NIST SP 800-38B", type: "NIST")
100
+ item = RelatonNist::NistBibliographicItem.new docid: [docid]
101
+ expect(RelatonNist::NistBibliography).to receive(:get).with("NIST SP 800-38B", nil, {}).and_return item
102
+ bib = @db.fetch "NIST SP 800-38B"
103
+ expect(bib).to be_instance_of RelatonNist::NistBibliographicItem
104
+ expect(bib.docidentifier[0].id).to eq "NIST SP 800-38B"
106
105
  end
107
106
  end
108
107
 
@@ -146,45 +145,45 @@ RSpec.describe Relaton::Db do
146
145
  end
147
146
 
148
147
  context "get GB reference" do
149
- it "and cache it" do
150
- VCR.use_cassette "gb_t_20223_2006" do
151
- bib = @db.fetch "CN(GB/T 20223)", "2006", {}
152
- expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
153
- expect(bib.to_xml(bibdata: true)).to include <<~XML
154
- <project-number>GB/T 20223</project-number>
155
- XML
156
- expect(File.exist?("testcache")).to be true
157
- expect(File.exist?("testcache2")).to be true
158
- testcache = Relaton::DbCache.new "testcache"
159
- expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
160
- <project-number>GB/T 20223</project-number>
161
- XML
162
- testcache = Relaton::DbCache.new "testcache2"
163
- expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
164
- <project-number>GB/T 20223</project-number>
165
- XML
166
- end
167
- end
168
-
169
- it "with year" do
170
- VCR.use_cassette "gb_t_20223_2006" do
171
- bib = @db.fetch "CN(GB/T 20223-2006)", nil, {}
172
- expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
173
- expect(bib.to_xml(bibdata: true)).to include <<~XML
174
- <project-number>GB/T 20223</project-number>
175
- XML
176
- expect(File.exist?("testcache")).to be true
177
- expect(File.exist?("testcache2")).to be true
178
- testcache = Relaton::DbCache.new "testcache"
179
- expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
180
- <project-number>GB/T 20223</project-number>
181
- XML
182
- testcache = Relaton::DbCache.new "testcache2"
183
- expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
184
- <project-number>GB/T 20223</project-number>
185
- XML
186
- end
187
- end
148
+ # it "and cache it" do
149
+ # VCR.use_cassette "gb_t_20223_2006" do
150
+ # bib = @db.fetch "CN(GB/T 20223)", "2006", {}
151
+ # expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
152
+ # expect(bib.to_xml(bibdata: true)).to include <<~XML
153
+ # <project-number>GB/T 20223</project-number>
154
+ # XML
155
+ # expect(File.exist?("testcache")).to be true
156
+ # expect(File.exist?("testcache2")).to be true
157
+ # testcache = Relaton::DbCache.new "testcache"
158
+ # expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
159
+ # <project-number>GB/T 20223</project-number>
160
+ # XML
161
+ # testcache = Relaton::DbCache.new "testcache2"
162
+ # expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
163
+ # <project-number>GB/T 20223</project-number>
164
+ # XML
165
+ # end
166
+ # end
167
+
168
+ # it "with year" do
169
+ # VCR.use_cassette "gb_t_20223_2006" do
170
+ # bib = @db.fetch "CN(GB/T 20223-2006)", nil, {}
171
+ # expect(bib).to be_instance_of RelatonGb::GbBibliographicItem
172
+ # expect(bib.to_xml(bibdata: true)).to include <<~XML
173
+ # <project-number>GB/T 20223</project-number>
174
+ # XML
175
+ # expect(File.exist?("testcache")).to be true
176
+ # expect(File.exist?("testcache2")).to be true
177
+ # testcache = Relaton::DbCache.new "testcache"
178
+ # expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
179
+ # <project-number>GB/T 20223</project-number>
180
+ # XML
181
+ # testcache = Relaton::DbCache.new "testcache2"
182
+ # expect(testcache["CN(GB/T 20223:2006)"]).to include <<~XML
183
+ # <project-number>GB/T 20223</project-number>
184
+ # XML
185
+ # end
186
+ # end
188
187
  end
189
188
 
190
189
  it "get RFC reference and cache it" do
@@ -244,17 +243,21 @@ RSpec.describe Relaton::Db do
244
243
  end
245
244
 
246
245
  it "get UN reference" do
247
- VCR.use_cassette "un_rtade_cefact_2004_32" do
248
- bib = @db.fetch "UN TRADE/CEFACT/2004/32", nil, {}
249
- expect(bib).to be_instance_of RelatonUn::UnBibliographicItem
250
- end
246
+ docid = RelatonBib::DocumentIdentifier.new(id: "UN TRADE/CEFACT/2004/32", type: "UN")
247
+ item = RelatonUn::UnBibliographicItem.new docid: [docid], session: RelatonUn::Session.new(session_number: "1")
248
+ expect(RelatonUn::UnBibliography).to receive(:get).with("UN TRADE/CEFACT/2004/32", nil, {}).and_return item
249
+ bib = @db.fetch "UN TRADE/CEFACT/2004/32", nil, {}
250
+ expect(bib).to be_instance_of RelatonUn::UnBibliographicItem
251
+ expect(bib.docidentifier.first.id).to eq "UN TRADE/CEFACT/2004/32"
251
252
  end
252
253
 
253
254
  it "get W3C reference" do
254
- VCR.use_cassette "w3c_json_ld11" do
255
- bib = @db.fetch "W3C REC-json-ld11-20200716", nil, {}
256
- expect(bib).to be_instance_of RelatonW3c::W3cBibliographicItem
257
- end
255
+ docid = RelatonBib::DocumentIdentifier.new(id: "W3C REC-json-ld11-20200716", type: "W3C")
256
+ item = RelatonW3c::W3cBibliographicItem.new docid: [docid]
257
+ expect(RelatonW3c::W3cBibliography).to receive(:get).with("W3C REC-json-ld11-20200716", nil, {}).and_return item
258
+ bib = @db.fetch "W3C REC-json-ld11-20200716", nil, {}
259
+ expect(bib).to be_instance_of RelatonW3c::W3cBibliographicItem
260
+ expect(bib.docidentifier.first.id).to eq "W3C REC-json-ld11-20200716"
258
261
  end
259
262
 
260
263
  it "get IEEE reference" do
@@ -265,10 +268,12 @@ RSpec.describe Relaton::Db do
265
268
  end
266
269
 
267
270
  it "get IHO reference" do
268
- VCR.use_cassette "iho_b_11" do
269
- bib = @db.fetch "IHO B-11"
270
- expect(bib).to be_instance_of RelatonIho::IhoBibliographicItem
271
- end
271
+ docid = RelatonBib::DocumentIdentifier.new(id: "IHO B-11", type: "IHO")
272
+ item = RelatonIho::IhoBibliographicItem.new docid: [docid]
273
+ expect(RelatonIho::IhoBibliography).to receive(:get).with("IHO B-11", nil, {}).and_return item
274
+ bib = @db.fetch "IHO B-11"
275
+ expect(bib).to be_instance_of RelatonIho::IhoBibliographicItem
276
+ expect(bib.docidentifier.first.id).to eq "IHO B-11"
272
277
  end
273
278
 
274
279
  it "get ECMA reference" do
@@ -314,15 +319,20 @@ RSpec.describe Relaton::Db do
314
319
  end
315
320
 
316
321
  it "get OASIS reference" do
317
- VCR.use_cassette "oasis_amqp_core_types_v1_0_pt1" do
318
- bib = @db.fetch "OASIS amqp-core-types-v1.0-Pt1"
319
- expect(bib).to be_instance_of RelatonOasis::OasisBibliographicItem
320
- end
322
+ docid = RelatonBib::DocumentIdentifier.new(id: "OASIS amqp-core-types-v1.0-Pt1", type: "OASIS")
323
+ item = RelatonOasis::OasisBibliographicItem.new docid: [docid]
324
+ expect(RelatonOasis::OasisBibliography).to receive(:get).with("OASIS amqp-core-types-v1.0-Pt1", nil, {}).and_return item
325
+ bib = @db.fetch "OASIS amqp-core-types-v1.0-Pt1"
326
+ expect(bib).to be_instance_of RelatonOasis::OasisBibliographicItem
321
327
  end
322
328
 
323
- it "get BIPM reference", vcr: "bipm_metrologia_29_6_373" do
329
+ it "get BIPM reference" do
330
+ docid = RelatonBib::DocumentIdentifier.new(id: "BIPM Metrologia 29 6 373", type: "BIPM")
331
+ item = RelatonBipm::BipmBibliographicItem.new docid: [docid]
332
+ expect(RelatonBipm::BipmBibliography).to receive(:get).with("BIPM Metrologia 29 6 373", nil, {}).and_return item
324
333
  bib = @db.fetch "BIPM Metrologia 29 6 373"
325
334
  expect(bib).to be_instance_of RelatonBipm::BipmBibliographicItem
335
+ expect(bib.docidentifier.first.id).to eq "BIPM Metrologia 29 6 373"
326
336
  end
327
337
 
328
338
  it "get DOI reference", vcr: "doi_10_6028_nist_ir_8245" do
@@ -334,10 +344,10 @@ RSpec.describe Relaton::Db do
334
344
  context "ISO" do
335
345
  it "included" do
336
346
  VCR.use_cassette "iso_combined_included" do
337
- bib = @db.fetch "ISO 19115-1 + Amd 1"
338
- expect(bib.docidentifier[0].id).to eq "ISO 19115-1 + Amd 1"
347
+ bib = @db.fetch "ISO 19115-1:2014 + Amd 1"
348
+ expect(bib.docidentifier[0].id).to eq "ISO 19115-1:2014 + Amd 1"
339
349
  expect(bib.relation[0].type).to eq "updates"
340
- expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ISO 19115-1"
350
+ expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014"
341
351
  expect(bib.relation[1].type).to eq "derivedFrom"
342
352
  expect(bib.relation[1].description).to be_nil
343
353
  expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014/Amd 1"
@@ -346,10 +356,10 @@ RSpec.describe Relaton::Db do
346
356
 
347
357
  it "applied" do
348
358
  VCR.use_cassette "iso_combined_applied" do
349
- bib = @db.fetch "ISO 19115-1, Amd 1"
350
- expect(bib.docidentifier[0].id).to eq "ISO 19115-1, Amd 1"
359
+ bib = @db.fetch "ISO 19115-1:2014, Amd 1"
360
+ expect(bib.docidentifier[0].id).to eq "ISO 19115-1:2014, Amd 1"
351
361
  expect(bib.relation[0].type).to eq "updates"
352
- expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ISO 19115-1"
362
+ expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014"
353
363
  expect(bib.relation[1].type).to eq "complements"
354
364
  expect(bib.relation[1].description.content).to eq "amendment"
355
365
  expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ISO 19115-1:2014/Amd 1"
@@ -359,49 +369,68 @@ RSpec.describe Relaton::Db do
359
369
 
360
370
  context "IEC" do
361
371
  it "included" do
362
- VCR.use_cassette "iec_combined_included" do
363
- bib = @db.fetch "IEC 60027-1, Amd 1, Amd 2"
364
- expect(bib.docidentifier[0].id).to eq "IEC 60027-1, Amd 1, Amd 2"
365
- expect(bib.relation[0].type).to eq "updates"
366
- expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "IEC 60027-1"
367
- expect(bib.relation[1].type).to eq "complements"
368
- expect(bib.relation[1].description.content).to eq "amendment"
369
- expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "IEC 60027-1/AMD1:1997"
370
- expect(bib.relation[2].type).to eq "complements"
371
- expect(bib.relation[2].description.content).to eq "amendment"
372
- expect(bib.relation[2].bibitem.docidentifier[0].id).to eq "IEC 60027-1/AMD2:2005"
373
- end
372
+ item = RelatonIec::IecBibliographicItem.new docid: [RelatonBib::DocumentIdentifier.new(id: "IEC 60027-1", type: "IEC")]
373
+ expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60027-1", nil, {}).and_return item
374
+ item1 = RelatonIec::IecBibliographicItem.new docid: [RelatonBib::DocumentIdentifier.new(id: "IEC 60027-1/AMD1:1997", type: "IEC")]
375
+ expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60027-1/Amd 1", nil, {}).and_return item1
376
+ item2 = RelatonIec::IecBibliographicItem.new docid: [RelatonBib::DocumentIdentifier.new(id: "IEC 60027-1/AMD2:2005", type: "IEC")]
377
+ expect(RelatonIec::IecBibliography).to receive(:get).with("IEC 60027-1/Amd 2", nil, {}).and_return item2
378
+ bib = @db.fetch "IEC 60027-1, Amd 1, Amd 2"
379
+ expect(bib.docidentifier[0].id).to eq "IEC 60027-1, Amd 1, Amd 2"
380
+ expect(bib.relation[0].type).to eq "updates"
381
+ expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "IEC 60027-1"
382
+ expect(bib.relation[1].type).to eq "complements"
383
+ expect(bib.relation[1].description.content).to eq "amendment"
384
+ expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "IEC 60027-1/AMD1:1997"
385
+ expect(bib.relation[2].type).to eq "complements"
386
+ expect(bib.relation[2].description.content).to eq "amendment"
387
+ expect(bib.relation[2].bibitem.docidentifier[0].id).to eq "IEC 60027-1/AMD2:2005"
374
388
  end
375
389
  end
376
390
 
377
391
  context "ITU" do
378
392
  it "included" do
379
- VCR.use_cassette "itu_combined_included" do
380
- bib = @db.fetch "ITU-T G.989.2, Amd 1, Amd 2"
381
- expect(bib.docidentifier[0].id).to eq "ITU-T G.989.2, Amd 1, Amd 2"
382
- expect(bib.relation[0].type).to eq "updates"
383
- expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2"
384
- expect(bib.relation[1].type).to eq "complements"
385
- expect(bib.relation[1].description.content).to eq "amendment"
386
- expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2 Amd 1"
387
- expect(bib.relation[2].type).to eq "complements"
388
- expect(bib.relation[2].description.content).to eq "amendment"
389
- expect(bib.relation[2].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2 Amd 2"
390
- end
393
+ docid = RelatonBib::DocumentIdentifier.new(id: "ITU-T G.989.2", type: "ITU")
394
+ group = RelatonItu::ItuGroup.new(name: "Group")
395
+ ed = RelatonItu::EditorialGroup.new(bureau: "Bureau", group: group)
396
+ item = RelatonItu::ItuBibliographicItem.new docid: [docid], editorialgroup: ed
397
+ expect(RelatonItu::ItuBibliography).to receive(:get).with("ITU-T G.989.2", nil, {}).and_return item
398
+ docid1 = RelatonBib::DocumentIdentifier.new(id: "ITU-T G.989.2 Amd 1", type: "ITU")
399
+ item1 = RelatonItu::ItuBibliographicItem.new docid: [docid1], editorialgroup: ed
400
+ expect(RelatonItu::ItuBibliography).to receive(:get).with("ITU-T G.989.2 Amd 1", nil, {}).and_return item1
401
+ docid2 = RelatonBib::DocumentIdentifier.new(id: "ITU-T G.989.2 Amd 2", type: "ITU")
402
+ item2 = RelatonItu::ItuBibliographicItem.new docid: [docid2], editorialgroup: ed
403
+ expect(RelatonItu::ItuBibliography).to receive(:get).with("ITU-T G.989.2 Amd 2", nil, {}).and_return item2
404
+ bib = @db.fetch "ITU-T G.989.2, Amd 1, Amd 2"
405
+ expect(bib.docidentifier[0].id).to eq "ITU-T G.989.2, Amd 1, Amd 2"
406
+ expect(bib.relation[0].type).to eq "updates"
407
+ expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2"
408
+ expect(bib.relation[1].type).to eq "complements"
409
+ expect(bib.relation[1].description.content).to eq "amendment"
410
+ expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2 Amd 1"
411
+ expect(bib.relation[2].type).to eq "complements"
412
+ expect(bib.relation[2].description.content).to eq "amendment"
413
+ expect(bib.relation[2].bibitem.docidentifier[0].id).to eq "ITU-T G.989.2 Amd 2"
391
414
  end
392
415
  end
393
416
 
394
417
  context "NIST" do
395
418
  it "included" do
396
- VCR.use_cassette "nist_combined_included" do
397
- bib = @db.fetch "NIST SP 800-38A, Add"
398
- expect(bib.docidentifier[0].id).to eq "NIST SP 800-38A, Add"
399
- expect(bib.relation[0].type).to eq "updates"
400
- expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "SP 800-38A"
401
- expect(bib.relation[1].type).to eq "complements"
402
- expect(bib.relation[1].description.content).to eq "amendment"
403
- expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "SP 800-38A-Add"
404
- end
419
+ # VCR.use_cassette "nist_combined_included" do
420
+ doci = RelatonBib::DocumentIdentifier.new(id: "SP 800-38A", type: "NIST")
421
+ item = RelatonNist::NistBibliographicItem.new docid: [doci]
422
+ expect(RelatonNist::NistBibliography).to receive(:get).with("NIST SP 800-38A", nil, {}).and_return item
423
+ docid1 = RelatonBib::DocumentIdentifier.new(id: "SP 800-38A-Add", type: "NIST")
424
+ item1 = RelatonNist::NistBibliographicItem.new docid: [docid1]
425
+ expect(RelatonNist::NistBibliography).to receive(:get).with("NIST SP 800-38A/Add", nil, {}).and_return item1
426
+ bib = @db.fetch "NIST SP 800-38A, Add"
427
+ expect(bib.docidentifier[0].id).to eq "NIST SP 800-38A, Add"
428
+ expect(bib.relation[0].type).to eq "updates"
429
+ expect(bib.relation[0].bibitem.docidentifier[0].id).to eq "SP 800-38A"
430
+ expect(bib.relation[1].type).to eq "complements"
431
+ expect(bib.relation[1].description.content).to eq "amendment"
432
+ expect(bib.relation[1].bibitem.docidentifier[0].id).to eq "SP 800-38A-Add"
433
+ # end
405
434
  end
406
435
  end
407
436
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/setup"
3
+ # require "bundler/setup"
4
4
  require "fileutils"
5
5
  require "rspec/matchers"
6
6
  require "equivalent-xml"
@@ -23,7 +23,7 @@ http_interactions:
23
23
  Connection:
24
24
  - keep-alive
25
25
  Content-Length:
26
- - '754'
26
+ - '1571'
27
27
  Cache-Control:
28
28
  - max-age=300
29
29
  Content-Security-Policy:
@@ -31,7 +31,7 @@ http_interactions:
31
31
  Content-Type:
32
32
  - text/plain; charset=utf-8
33
33
  Etag:
34
- - W/"7c959a43129b264a7c1e12e965e5c264a2a5f981072544989a9873d021c46a8d"
34
+ - W/"5c52c138afbf38ea9b65dea62e48d43c568b9b5195525cf830778c2c029846a2"
35
35
  Strict-Transport-Security:
36
36
  - max-age=31536000
37
37
  X-Content-Type-Options:
@@ -41,36 +41,37 @@ http_interactions:
41
41
  X-Xss-Protection:
42
42
  - 1; mode=block
43
43
  X-Github-Request-Id:
44
- - 7496:0207:4FD3F2:6988C4:6388D860
44
+ - AF94:0BB8:82E1EC:C34C77:6418BDF8
45
45
  Accept-Ranges:
46
46
  - bytes
47
47
  Date:
48
- - Thu, 01 Dec 2022 16:37:52 GMT
48
+ - Mon, 20 Mar 2023 20:11:37 GMT
49
49
  Via:
50
50
  - 1.1 varnish
51
51
  X-Served-By:
52
- - cache-atl18456-ATL
52
+ - cache-iad-kjyo7100116-IAD
53
53
  X-Cache:
54
54
  - MISS
55
55
  X-Cache-Hits:
56
56
  - '0'
57
57
  X-Timer:
58
- - S1669912673.825654,VS0,VE158
58
+ - S1679343097.936255,VS0,VE191
59
59
  Vary:
60
60
  - Authorization,Accept-Encoding,Origin
61
61
  Access-Control-Allow-Origin:
62
62
  - "*"
63
63
  X-Fastly-Request-Id:
64
- - cccf475f5d37d90f0494ab5079476a56f722fe36
64
+ - baac0cdd547b3db0edeca1c739043b643f24467b
65
65
  Expires:
66
- - Thu, 01 Dec 2022 16:42:52 GMT
66
+ - Mon, 20 Mar 2023 20:16:37 GMT
67
67
  Source-Age:
68
68
  - '0'
69
69
  body:
70
70
  encoding: ASCII-8BIT
71
71
  string: |
72
72
  ---
73
- id: 3GPPTR00.01U-UMTS/3.0.0
73
+ schema-version: v1.2.1
74
+ id: TR00.01U-UMTS-3.0.0
74
75
  title:
75
76
  - content: Work programme for the standardization of Universal Mobile Telecommunications
76
77
  System (UMTS)
@@ -103,8 +104,8 @@ http_interactions:
103
104
  country: France
104
105
  postcode: '06921'
105
106
  role:
106
- - author
107
- - publisher
107
+ - type: author
108
+ - type: publisher
108
109
  - person:
109
110
  name:
110
111
  completename:
@@ -118,7 +119,7 @@ http_interactions:
118
119
  name:
119
120
  - content: PHILIPS CONSUMER COMMUNICATION
120
121
  role:
121
- - author
122
+ - type: author
122
123
  revdate: '1994-11-18'
123
124
  language:
124
125
  - en
@@ -129,11 +130,12 @@ http_interactions:
129
130
  value: withdrawn
130
131
  place:
131
132
  - Sophia Antipolis Cedex, France
132
- fetched: '2022-09-21'
133
133
  doctype: TR
134
134
  editorialgroup:
135
135
  - name: SMG5
136
136
  type: prime
137
+ ext:
138
+ schema-version: v1.0.1
137
139
  radiotechnology: 3G
138
140
  release:
139
141
  version2g: '3'
@@ -145,5 +147,5 @@ http_interactions:
145
147
  freeze_stage3_meeting: SMG-28
146
148
  close_meeting: SP-28
147
149
  project_end: '1999-02-12'
148
- recorded_at: Thu, 01 Dec 2022 16:37:52 GMT
150
+ recorded_at: Mon, 20 Mar 2023 20:11:37 GMT
149
151
  recorded_with: VCR 6.1.0