relaton 1.17.1 → 1.17.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: 4c48cfe6f0f4984a5141f07a08d0aad1350910f07b87c3f6e028b91a1b81df17
4
- data.tar.gz: 328a7973781a7c2061977fba41d914da92a459adc0c4e73d1827ac66149cbe4a
3
+ metadata.gz: 18c8244f75e034cd05320232fae767d59e10bd6de5f2983dad701ed8ddcbef59
4
+ data.tar.gz: b384e225f15c0fb4600f8bd245e6ee4a5c2820bbaf3fc865a308972e358a3fd6
5
5
  SHA512:
6
- metadata.gz: dfe07c36cc548cd44b664834062eaace4acb9a605b666373fa13eb5049e39ead615718151510750100632169add0195bc6414e309b5ecbe7268c1b4bbf0e8b2a
7
- data.tar.gz: bdf5d46cc33412f1428882a10b343bf7e4a4042c45b67622fe1d8afcd02999f45786e3faccdba279f68c7b2a631f7f6d7671023e12a5f6d079033968521340af
6
+ metadata.gz: c83e2b59913fead7d8a7fee650ed739330c3f7cbccfc63eec6d9530e7ca433e3bd026f2c7a15a61735b0b2e72d4106fd7ddd6ddc9a4e3cd00be349c2c288a497
7
+ data.tar.gz: 49ff93fb5f75841a9ae70dae67c437e3b04fa29977dd96cc9a6470ad5dee4183ccf99951a8aa950551b0811a08c3b03f12eb7b3bcbcd7565b039e167fe8e1a23
@@ -10,7 +10,7 @@ module Relaton
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
12
  relaton_cen relaton_iana relaton_3gpp relaton_oasis relaton_doi relaton_jis
13
- relaton_xsf relaton_ccsds relaton_etsi
13
+ relaton_xsf relaton_ccsds relaton_etsi relaton_isbn
14
14
  ].freeze
15
15
 
16
16
  include Singleton
@@ -1,3 +1,3 @@
1
1
  module Relaton
2
- VERSION = "1.17.1".freeze
2
+ VERSION = "1.17.2".freeze
3
3
  end
data/relaton.gemspec CHANGED
@@ -45,6 +45,7 @@ Gem::Specification.new do |spec|
45
45
  spec.add_dependency "relaton-ieee", "~> 1.17.0"
46
46
  spec.add_dependency "relaton-ietf", "~> 1.17.0"
47
47
  spec.add_dependency "relaton-iho", "~> 1.17.0"
48
+ spec.add_dependency "relaton-isbn", "~> 1.17.0"
48
49
  spec.add_dependency "relaton-iso", "~> 1.17.0"
49
50
  spec.add_dependency "relaton-itu", "~> 1.17.0"
50
51
  spec.add_dependency "relaton-jis", "~> 1.17.0"
@@ -33,41 +33,81 @@ RSpec.describe Relaton::Processor do
33
33
  end
34
34
  end
35
35
 
36
- context "ETSI processor" do
36
+ context "flavor processors" do
37
37
  before { Relaton::Registry.instance }
38
- let(:processor) { Relaton::Registry.instance.by_type "ETSI" }
39
38
 
40
- it "get method should call get method of ETSI" do
41
- expect(RelatonEtsi::Bibliography).to receive(:get).with("code", nil, {}).and_return :item
42
- expect(processor.get "code", nil, {}).to eq :item
39
+ shared_examples "common processor methods" do |flavor, namespace, bibmodule|
40
+ let(:processor) { Relaton::Registry.instance.by_type flavor }
41
+ let(:flavor_module) { Object.const_get namespace }
42
+ let(:bibliography) { Object.const_get "#{namespace}::#{bibmodule}" }
43
+
44
+ it "get method should call get method of #{flavor}" do
45
+ expect(bibliography).to receive(:get).with("code", nil, {}).and_return :item
46
+ expect(processor.get "code", nil, {}).to eq :item
47
+ end
48
+
49
+ it "grammar_hash method should call grammar_hash method of #{flavor}" do
50
+ expect(flavor_module).to receive(:grammar_hash).and_return :hash
51
+ expect(processor.grammar_hash).to eq :hash
52
+ end
53
+ end
54
+
55
+ shared_examples "fetch_data method" do |flavor, fetcher, source|
56
+ let(:processor) { Relaton::Registry.instance.by_type flavor }
57
+ let(:fetcher_class) { Object.const_get fetcher }
58
+
59
+ it "fetch_data method should call fetch_data method of #{flavor}" do
60
+ expect(fetcher_class).to receive(:fetch).with(output: "dir", format: "bibxml").and_return :item
61
+ expect(processor.fetch_data source, output: "dir", format: "bibxml").to eq :item
62
+ end
43
63
  end
44
64
 
45
- it "fetch_data method should call fetch_data method of ETSI" do
46
- expect(RelatonEtsi::DataFetcher).to receive(:fetch).with(output: "dir", format: "bibxml").and_return :item
47
- expect(processor.fetch_data "etsi-csv", output: "dir", format: "bibxml").to eq :item
65
+ shared_examples "from_xml method" do |flavor, parser|
66
+ let(:processor) { Relaton::Registry.instance.by_type flavor }
67
+ let(:parser_class) { Object.const_get parser }
68
+
69
+ it "from_xml method should call from_xml method of #{flavor}" do
70
+ expect(parser_class).to receive(:from_xml).with("xml").and_return :item
71
+ expect(processor.from_xml "xml").to eq :item
72
+ end
48
73
  end
49
74
 
50
- it "from_xml method should call from_xml method of ETSI" do
51
- expect(RelatonEtsi::XMLParser).to receive(:from_xml).with("xml").and_return :item
52
- expect(processor.from_xml "xml").to eq :item
75
+ shared_examples "hash_to_bib method" do |flavor, converter, bibitem|
76
+ let(:processor) { Relaton::Registry.instance.by_type flavor }
77
+ let(:converter_class) { Object.const_get converter }
78
+ let(:bibitem_class) { Object.const_get bibitem }
79
+
80
+ it "hash_to_bib method should call hash_to_bib method of #{flavor}" do
81
+ expect(converter_class).to receive(:hash_to_bib).with(:hash).and_return title: "title"
82
+ expect(bibitem_class).to receive(:new).with(title: "title").and_return :item
83
+ expect(processor.hash_to_bib(:hash)).to eq :item
84
+ end
53
85
  end
54
86
 
55
- it "hash_to_bib method should call hash_to_bib method of ETSI" do
56
- expect(RelatonEtsi::HashConverter).to receive(:hash_to_bib).with(:hash).and_return title: "title"
57
- expect(RelatonEtsi::BibliographicItem).to receive(:new).with(title: "title").and_return :item
58
- expect(processor.hash_to_bib(:hash)).to eq :item
87
+ shared_examples "remove_index_file method" do |flavor, file|
88
+ let(:processor) { Relaton::Registry.instance.by_type flavor }
89
+
90
+ it "remove index file" do
91
+ index = double "index"
92
+ expect(index).to receive(:remove_file)
93
+ expect(Relaton::Index).to receive(:find_or_create)
94
+ .with(flavor.downcase.to_sym, url: true, file: file).and_return index
95
+ processor.remove_index_file
96
+ end
59
97
  end
60
98
 
61
- it "grammar_hash method should call grammar_hash method of ETSI" do
62
- expect(RelatonEtsi).to receive(:grammar_hash).and_return :hash
63
- expect(processor.grammar_hash).to eq :hash
99
+ context "ETSI processor" do
100
+ it_behaves_like "common processor methods", "ETSI", "RelatonEtsi", "Bibliography"
101
+ it_behaves_like "fetch_data method", "ETSI", "RelatonEtsi::DataFetcher", "etsi-csv"
102
+ it_behaves_like "from_xml method", "ETSI", "RelatonEtsi::XMLParser"
103
+ it_behaves_like "hash_to_bib method", "ETSI", "RelatonEtsi::HashConverter", "RelatonEtsi::BibliographicItem"
104
+ it_behaves_like "remove_index_file method", "ETSI", "index-v1.yaml"
64
105
  end
65
106
 
66
- it "remove index file" do
67
- index = double "index"
68
- expect(index).to receive(:remove_file)
69
- expect(Relaton::Index).to receive(:find_or_create).with(:etsi, url: true, file: "index-v1.yaml").and_return index
70
- processor.remove_index_file
107
+ context "ISBN processor" do
108
+ it_behaves_like "common processor methods", "ISBN", "RelatonIsbn", "OpenLibrary"
109
+ it_behaves_like "from_xml method", "ISBN", "RelatonBib::XMLParser"
110
+ it_behaves_like "hash_to_bib method", "ISBN", "RelatonBib::HashConverter", "RelatonBib::BibliographicItem"
71
111
  end
72
112
  end
73
113
  end
@@ -123,6 +123,10 @@ RSpec.describe Relaton::Registry do
123
123
  it "ETSI" do
124
124
  expect(Relaton::Registry.instance.by_type("ETSI")).to be_instance_of RelatonEtsi::Processor
125
125
  end
126
+
127
+ it "ISBN" do
128
+ expect(Relaton::Registry.instance.by_type("ISBN")).to be_instance_of RelatonIsbn::Processor
129
+ end
126
130
  end
127
131
 
128
132
  it "find processot by dataset" do
data/spec/relaton_spec.rb CHANGED
@@ -364,6 +364,15 @@ RSpec.describe Relaton::Db do
364
364
  expect(bib.docidentifier.first.id).to eq "ETSI EN 300 175-8"
365
365
  end
366
366
 
367
+ it "get ISBN reference" do
368
+ docid = RelatonBib::DocumentIdentifier.new(id: "ISBN 978-0-580-50101-4", type: "ISBN")
369
+ item = RelatonBib::BibliographicItem.new docid: [docid]
370
+ expect(RelatonIsbn::OpenLibrary).to receive(:get).with("ISBN 978-0-580-50101-4", nil, {}).and_return item
371
+ bib = @db.fetch "ISBN 978-0-580-50101-4"
372
+ expect(bib).to be_instance_of RelatonBib::BibliographicItem
373
+ expect(bib.docidentifier.first.id).to eq "ISBN 978-0-580-50101-4"
374
+ end
375
+
367
376
  context "get combined documents" do
368
377
  context "ISO" do
369
378
  it "included" do
@@ -39,21 +39,21 @@ http_interactions:
39
39
  X-Xss-Protection:
40
40
  - 1; mode=block
41
41
  X-Github-Request-Id:
42
- - 11E4:4F03:4125C0:503C5F:656F52FF
42
+ - EA0A:234C:6136C2:76A26F:657CBECC
43
43
  Accept-Ranges:
44
44
  - bytes
45
45
  Date:
46
- - Tue, 05 Dec 2023 16:42:40 GMT
46
+ - Fri, 15 Dec 2023 21:02:05 GMT
47
47
  Via:
48
48
  - 1.1 varnish
49
49
  X-Served-By:
50
- - cache-pdk-kpdk1780129-PDK
50
+ - cache-pdk-kpdk1780087-PDK
51
51
  X-Cache:
52
52
  - MISS
53
53
  X-Cache-Hits:
54
54
  - '0'
55
55
  X-Timer:
56
- - S1701794560.721009,VS0,VE285
56
+ - S1702674125.021523,VS0,VE264
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
- - f683743f80297a5c7399717914acb4a5a05fd219
64
+ - 7cf65cbbcbdaeb1dfc42be6245dcb99d105b95c2
65
65
  Expires:
66
- - Tue, 05 Dec 2023 16:47:40 GMT
66
+ - Fri, 15 Dec 2023 21:07:05 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: Tue, 05 Dec 2023 16:42:40 GMT
11302
+ recorded_at: Fri, 15 Dec 2023 21:02:05 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
@@ -11341,21 +11341,21 @@ http_interactions:
11341
11341
  X-Xss-Protection:
11342
11342
  - 1; mode=block
11343
11343
  X-Github-Request-Id:
11344
- - D61C:48FC:4B5092:59D776:656F5302
11344
+ - B8D8:0424:5FE216:754B4B:657CBED0
11345
11345
  Accept-Ranges:
11346
11346
  - bytes
11347
11347
  Date:
11348
- - Tue, 05 Dec 2023 16:42:43 GMT
11348
+ - Fri, 15 Dec 2023 21:02:08 GMT
11349
11349
  Via:
11350
11350
  - 1.1 varnish
11351
11351
  X-Served-By:
11352
- - cache-pdk-kpdk1780024-PDK
11352
+ - cache-pdk-kpdk1780090-PDK
11353
11353
  X-Cache:
11354
11354
  - MISS
11355
11355
  X-Cache-Hits:
11356
11356
  - '0'
11357
11357
  X-Timer:
11358
- - S1701794563.329136,VS0,VE154
11358
+ - S1702674129.629585,VS0,VE137
11359
11359
  Vary:
11360
11360
  - Authorization,Accept-Encoding,Origin
11361
11361
  Access-Control-Allow-Origin:
@@ -11363,9 +11363,9 @@ http_interactions:
11363
11363
  Cross-Origin-Resource-Policy:
11364
11364
  - cross-origin
11365
11365
  X-Fastly-Request-Id:
11366
- - 45c52a8b760e95b1664943a6195e6ec4f0a50f44
11366
+ - e5a350b43167b7f3d41e7f2809b0d4869346f491
11367
11367
  Expires:
11368
- - Tue, 05 Dec 2023 16:47:43 GMT
11368
+ - Fri, 15 Dec 2023 21:07:08 GMT
11369
11369
  Source-Age:
11370
11370
  - '0'
11371
11371
  body:
@@ -11406,5 +11406,5 @@ http_interactions:
11406
11406
  bWVldGluZzogU01HLTI4CiAgZnJlZXplX3N0YWdlMl9tZWV0aW5nOiBTTUct
11407
11407
  MjgKICBmcmVlemVfc3RhZ2UzX21lZXRpbmc6IFNNRy0yOAogIGNsb3NlX21l
11408
11408
  ZXRpbmc6IFNQLTI4CiAgcHJvamVjdF9lbmQ6ICcxOTk5LTAyLTEyJwo=
11409
- recorded_at: Tue, 05 Dec 2023 16:42:43 GMT
11409
+ recorded_at: Fri, 15 Dec 2023 21:02:08 GMT
11410
11410
  recorded_with: VCR 6.2.0
@@ -27,27 +27,27 @@ http_interactions:
27
27
  Connection:
28
28
  - keep-alive
29
29
  Date:
30
- - Tue, 05 Dec 2023 16:43:26 GMT
30
+ - Fri, 15 Dec 2023 21:02:54 GMT
31
31
  X-Amzn-Requestid:
32
- - 88968a1b-e582-47e4-8e08-ffc11fefacb0
32
+ - d5797694-3f7c-4b5c-b0b4-4e258aa6421b
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
- - PensrHqYIAMEh2A=
38
+ - QALFSHcAoAMEfnQ=
39
39
  Access-Control-Allow-Methods:
40
40
  - GET, POST, OPTIONS
41
41
  X-Amzn-Trace-Id:
42
- - Root=1-656f531d-251edaf641248c0a0f364242;Sampled=0;lineage=521d48d5:0
42
+ - Root=1-657cbeee-0e87a651219ca2fd35614c22;Sampled=0;lineage=521d48d5:0
43
43
  X-Cache:
44
44
  - Miss from cloudfront
45
45
  Via:
46
- - 1.1 812defed1167ca00304e9ce555dcf6e2.cloudfront.net (CloudFront)
46
+ - 1.1 fc1009b8e45427207e2a571827e9dd24.cloudfront.net (CloudFront)
47
47
  X-Amz-Cf-Pop:
48
48
  - ATL51-C1
49
49
  X-Amz-Cf-Id:
50
- - QlVdV_CYpctbsOSHcjpChAXOOdlfeMWFOR2a0SPBh_LCkSo93IauLg==
50
+ - _diMw4SxewdLl3Da5yx4iI-ZOXbCTRmzU6L0JQUGRIumlHu4ejmYCg==
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: Tue, 05 Dec 2023 16:43:25 GMT
120
+ recorded_at: Fri, 15 Dec 2023 21:02:54 GMT
121
121
  recorded_with: VCR 6.2.0