toccatore 0.4.0 → 0.4.9
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 +4 -4
- data/Gemfile.lock +12 -3
- data/lib/toccatore/cli.rb +1 -1
- data/lib/toccatore/queue.rb +8 -2
- data/lib/toccatore/usage_update.rb +64 -52
- data/lib/toccatore/version.rb +1 -1
- data/spec/cli_spec.rb +4 -4
- data/spec/datacite_related_spec.rb +1 -1
- data/spec/factories/default.rb +22 -0
- data/spec/fixtures/event_data_resp_2 +4 -4
- data/spec/fixtures/events_empty.json +33 -0
- data/spec/fixtures/usage_event.json +1 -1
- data/spec/fixtures/usage_event_fail.json +1 -1
- data/spec/fixtures/usage_events.json +8 -8
- data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_related_identifier.yml +1 -1
- data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml +66 -20
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml +13 -13
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml +13 -13
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml +95 -0
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml +95 -0
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml +187 -0
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml +52 -0
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml +1039 -80
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml +289 -0
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml +49 -0
- data/spec/queque_spec.rb +44 -58
- data/spec/spec_helper.rb +9 -1
- data/spec/usage_update_spec.rb +50 -60
- data/toccatore.gemspec +4 -0
- metadata +53 -6
- data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_fail.yml +0 -150
- data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_succeed_with_no_works.yml +0 -150
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_DataCite_Event_Data.yml +0 -199
data/spec/usage_update_spec.rb
CHANGED
|
@@ -10,32 +10,6 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
|
10
10
|
|
|
11
11
|
let(:dummy_message){sqs.receive_message(queue_url: queue_url, max_number_of_messages: 1, wait_time_seconds: 1)}
|
|
12
12
|
|
|
13
|
-
# context "queue_jobs" do
|
|
14
|
-
# it "should report if there are no works returned by the Usage Queue" do
|
|
15
|
-
# puts subject.queue_url
|
|
16
|
-
# response = subject.queue_jobs
|
|
17
|
-
# expect(response).to eq(0)
|
|
18
|
-
# end
|
|
19
|
-
|
|
20
|
-
# it "should report if there are works returned by the Usage Queue" do
|
|
21
|
-
# response = subject.queue_jobs
|
|
22
|
-
# expect(response).to eq(3)
|
|
23
|
-
# end
|
|
24
|
-
# end
|
|
25
|
-
|
|
26
|
-
# context "format_event" do
|
|
27
|
-
# it "should report if there are no works returned by the Usage Queue" do
|
|
28
|
-
# body = File.read(fixture_path + 'usage_update_nil.json')
|
|
29
|
-
# result = OpenStruct.new(body: JSON.parse(body) )
|
|
30
|
-
# expect(subject.format_event(result)).to eq([])
|
|
31
|
-
# end
|
|
32
|
-
|
|
33
|
-
# it "should report if there are works returned by the Usage Queue" do
|
|
34
|
-
# body = File.read(fixture_path + 'usage_update.json')
|
|
35
|
-
# result = OpenStruct.new(body: JSON.parse(body) )
|
|
36
|
-
# expect(subject.format_event(result).length).to eq(40)
|
|
37
|
-
# end
|
|
38
|
-
# end
|
|
39
13
|
|
|
40
14
|
describe "get_data" do
|
|
41
15
|
context "when there are messages" do
|
|
@@ -59,14 +33,14 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
|
59
33
|
end
|
|
60
34
|
end
|
|
61
35
|
|
|
62
|
-
context "when there are NOT messages" do
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
end
|
|
36
|
+
# context "when there are NOT messages" do
|
|
37
|
+
# it "should return empty" do
|
|
38
|
+
# sqs.stub_responses(:receive_message, messages: [])
|
|
39
|
+
# response = sqs.receive_message({queue_url: queue_url})
|
|
40
|
+
# response = subject.get_data(response)
|
|
41
|
+
# expect(response.body["errors"]).to eq("Queue is empty")
|
|
42
|
+
# end
|
|
43
|
+
# end
|
|
70
44
|
end
|
|
71
45
|
|
|
72
46
|
describe "parse_data" do
|
|
@@ -74,14 +48,24 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
|
74
48
|
it "should return errors" do
|
|
75
49
|
body = File.read(fixture_path + 'usage_update_nil.json')
|
|
76
50
|
result = OpenStruct.new(body: JSON.parse(body) )
|
|
51
|
+
expect(subject.parse_data(result)).to be_a(Array)
|
|
77
52
|
expect(subject.parse_data(result)).to eq([{"status"=>"404", "title"=>"The resource you are looking for doesn't exist."}])
|
|
78
53
|
end
|
|
79
54
|
end
|
|
80
55
|
|
|
56
|
+
# context "when the queue is empty" do
|
|
57
|
+
# it "should return errors" do
|
|
58
|
+
# result = OpenStruct.new(body: { "errors" => "Queue is empty" })
|
|
59
|
+
# expect(subject.parse_data(result)).to be_a(Array)
|
|
60
|
+
# expect(subject.parse_data(result)).to eq([{"status"=>"404", "title"=>"The resource you are looking for doesn't exist."}])
|
|
61
|
+
# end
|
|
62
|
+
# end
|
|
63
|
+
|
|
81
64
|
context "when the usage report was NOT found" do
|
|
82
65
|
it "should return errors" do
|
|
83
66
|
body = File.read(fixture_path + 'usage_update_nil.json')
|
|
84
67
|
result = OpenStruct.new(body: JSON.parse(body) )
|
|
68
|
+
expect(subject.parse_data(result)).to be_a(Array)
|
|
85
69
|
expect(subject.parse_data(result)).to eq([{"status"=>"404", "title"=>"The resource you are looking for doesn't exist."}])
|
|
86
70
|
end
|
|
87
71
|
end
|
|
@@ -89,67 +73,73 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
|
89
73
|
context "when the report was found" do
|
|
90
74
|
it "should parsed it correctly" do
|
|
91
75
|
body = File.read(fixture_path + 'usage_update.json')
|
|
92
|
-
result = OpenStruct.new(body: JSON.parse(body) )
|
|
76
|
+
result = OpenStruct.new(body: JSON.parse(body), url:"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" )
|
|
93
77
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
|
94
78
|
expect(response.length).to eq(2)
|
|
95
|
-
expect(response.last.except("
|
|
79
|
+
expect(response.last.except("uuid")).to eq("subj"=>{"pid"=>"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"},"total"=>3,"message-action" => "add", "subj-id"=>"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "obj-id"=>"https://doi.org/10.7291/d1q94r", "relation-type-id"=>"unique-dataset-investigations-regular", "source-id"=>"datacite-usage", "occurred-at"=>"2128-04-09", "license" => "https://creativecommons.org/publicdomain/zero/1.0/", "source-token" => "43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc")
|
|
96
80
|
end
|
|
97
81
|
|
|
98
82
|
it "should parsed it correctly when it has five metrics and two DOIs" do
|
|
99
83
|
body = File.read(fixture_path + 'usage_update_3.json')
|
|
100
|
-
result = OpenStruct.new(body: JSON.parse(body) )
|
|
84
|
+
result = OpenStruct.new(body: JSON.parse(body), url:"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" )
|
|
101
85
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
|
102
86
|
expect(response.length).to eq(5)
|
|
103
|
-
expect(response.last.except("
|
|
87
|
+
expect(response.last.except("uuid")).to eq("message-action"=>"add", "subj-id"=>"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "subj"=>{"pid"=>"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"}, "total"=>208, "obj-id"=>"https://doi.org/10.6071/z7wc73", "relation-type-id"=>"Unique-Dataset-Requests-Machine", "source-id"=>"datacite-usage", "source-token"=>"43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc", "occurred-at"=>"2128-04-09", "license"=>"https://creativecommons.org/publicdomain/zero/1.0/")
|
|
104
88
|
end
|
|
105
89
|
|
|
106
90
|
it "should parsed it correctly when it has two metrics per DOI " do
|
|
107
91
|
body = File.read(fixture_path + 'usage_update_2.json')
|
|
108
|
-
result = OpenStruct.new(body: JSON.parse(body) )
|
|
92
|
+
result = OpenStruct.new(body: JSON.parse(body), url:"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" , url:"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" )
|
|
109
93
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
|
110
94
|
expect(response.length).to eq(4)
|
|
111
|
-
expect(response.last.except("
|
|
95
|
+
expect(response.last.except("uuid")).to eq("message-action"=>"add", "subj-id"=>"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "subj"=>{"pid"=>"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"}, "total"=>208, "obj-id"=>"https://doi.org/10.6071/z7wc73", "relation-type-id"=>"Unique-Dataset-Requests-Machine", "source-id"=>"datacite-usage", "source-token"=>"43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc", "occurred-at"=>"2128-04-09", "license"=>"https://creativecommons.org/publicdomain/zero/1.0/")
|
|
112
96
|
end
|
|
113
97
|
|
|
114
98
|
it "should send a warning if there are more than 4 metrics" do
|
|
115
99
|
body = File.read(fixture_path + 'usage_update_1.json')
|
|
116
|
-
result = OpenStruct.new(body: JSON.parse(body) )
|
|
100
|
+
result = OpenStruct.new(body: JSON.parse(body), url:"https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" )
|
|
117
101
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
|
118
102
|
expect(response.length).to eq(1)
|
|
119
|
-
expect(
|
|
103
|
+
expect(subject.parse_data(result)).to be_a(Array)
|
|
104
|
+
expect(response.last.body).to eq({"errors"=>"There are too many instances in 10.7291/D1Q94R for report https://metrics.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad. There can only be 4"})
|
|
120
105
|
end
|
|
121
106
|
end
|
|
122
107
|
end
|
|
123
108
|
|
|
124
109
|
context "push_data" do
|
|
110
|
+
let!(:events) {create_list(:event,10)}
|
|
125
111
|
it "should report if there are no works returned by the Queue" do
|
|
126
112
|
result = []
|
|
127
113
|
expect { subject.push_data(result) }.to output("No works found in the Queue.\n").to_stdout
|
|
128
114
|
end
|
|
129
115
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
116
|
+
it "should fail if format of the event is wrong" do
|
|
117
|
+
body = File.read(fixture_path + 'usage_events.json')
|
|
118
|
+
expect = File.read(fixture_path + 'event_data_resp_2')
|
|
119
|
+
result = JSON.parse(body)
|
|
120
|
+
options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['ACCESS_TOKEN'], jsonapi: true }
|
|
121
|
+
expect(subject.push_data(result, options)).to eq(4)
|
|
122
|
+
end
|
|
137
123
|
|
|
138
|
-
it "should
|
|
139
|
-
body = File.read(fixture_path + '
|
|
140
|
-
result =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['LAGOTTO_TOKEN'], jsonapi: true }
|
|
144
|
-
expect { subject.push_data(result, options) }.to output(expect).to_stdout
|
|
124
|
+
it "should fail if format of the event is empty" do
|
|
125
|
+
body = File.read(fixture_path + 'events_empty.json')
|
|
126
|
+
result = JSON.parse(body)
|
|
127
|
+
options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['ACCESS_TOKEN'], jsonapi: true }
|
|
128
|
+
expect(subject.push_data(result, options)).to eq(1)
|
|
145
129
|
end
|
|
146
130
|
|
|
147
|
-
it "should
|
|
131
|
+
# it "should work with DataCite Event Data 2" do
|
|
132
|
+
# dd = events.map {|event| event.to_h.stringify_keys}
|
|
133
|
+
# all_events = dd.map {|item| item.map{ |k, v| [k.dasherize, v] }.to_h}
|
|
134
|
+
# options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['ACCESS_TOKEN'], jsonapi: true }
|
|
135
|
+
# expect(subject.push_data(all_events, options)).to eq(0)
|
|
136
|
+
# end
|
|
137
|
+
|
|
138
|
+
it "should work with a single item" do
|
|
148
139
|
body = File.read(fixture_path + 'usage_events.json')
|
|
149
|
-
expect = File.read(fixture_path + 'event_data_resp_2')
|
|
150
140
|
result = JSON.parse(body)
|
|
151
|
-
options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['
|
|
152
|
-
expect
|
|
141
|
+
options = { push_url: ENV['LAGOTTINO_URL'], access_token: ENV['ACCESS_TOKEN'], jsonapi: true }
|
|
142
|
+
expect(subject.push_item(result.first, options)).to eq(1)
|
|
153
143
|
end
|
|
154
144
|
end
|
|
155
145
|
|
data/toccatore.gemspec
CHANGED
|
@@ -24,6 +24,8 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_dependency 'thor', '~> 0.19'
|
|
25
25
|
s.add_dependency 'slack-notifier', '= 2.2.2'
|
|
26
26
|
s.add_dependency 'aws-sdk-sqs'
|
|
27
|
+
s.add_dependency 'factory_bot'
|
|
28
|
+
|
|
27
29
|
s.add_development_dependency 'bundler', '~> 1.0'
|
|
28
30
|
s.add_development_dependency 'rspec', '~> 3.4'
|
|
29
31
|
s.add_development_dependency 'rake', '~> 12.0'
|
|
@@ -32,6 +34,8 @@ Gem::Specification.new do |s|
|
|
|
32
34
|
s.add_development_dependency 'webmock', '~> 1.22', '>= 1.22.3'
|
|
33
35
|
s.add_development_dependency 'codeclimate-test-reporter', '~> 1.0', '>= 1.0.0'
|
|
34
36
|
s.add_development_dependency 'simplecov', '~> 0.12.0'
|
|
37
|
+
s.add_development_dependency 'factory_bot'
|
|
38
|
+
s.add_development_dependency 'faker'
|
|
35
39
|
|
|
36
40
|
s.require_paths = ["lib"]
|
|
37
41
|
s.files = `git ls-files`.split($/)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: toccatore
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Martin Fenner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-05-
|
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: maremma
|
|
@@ -134,6 +134,20 @@ dependencies:
|
|
|
134
134
|
- - ">="
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
136
|
version: '0'
|
|
137
|
+
- !ruby/object:Gem::Dependency
|
|
138
|
+
name: factory_bot
|
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
|
140
|
+
requirements:
|
|
141
|
+
- - ">="
|
|
142
|
+
- !ruby/object:Gem::Version
|
|
143
|
+
version: '0'
|
|
144
|
+
type: :runtime
|
|
145
|
+
prerelease: false
|
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
147
|
+
requirements:
|
|
148
|
+
- - ">="
|
|
149
|
+
- !ruby/object:Gem::Version
|
|
150
|
+
version: '0'
|
|
137
151
|
- !ruby/object:Gem::Dependency
|
|
138
152
|
name: bundler
|
|
139
153
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -264,6 +278,34 @@ dependencies:
|
|
|
264
278
|
- - "~>"
|
|
265
279
|
- !ruby/object:Gem::Version
|
|
266
280
|
version: 0.12.0
|
|
281
|
+
- !ruby/object:Gem::Dependency
|
|
282
|
+
name: factory_bot
|
|
283
|
+
requirement: !ruby/object:Gem::Requirement
|
|
284
|
+
requirements:
|
|
285
|
+
- - ">="
|
|
286
|
+
- !ruby/object:Gem::Version
|
|
287
|
+
version: '0'
|
|
288
|
+
type: :development
|
|
289
|
+
prerelease: false
|
|
290
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
291
|
+
requirements:
|
|
292
|
+
- - ">="
|
|
293
|
+
- !ruby/object:Gem::Version
|
|
294
|
+
version: '0'
|
|
295
|
+
- !ruby/object:Gem::Dependency
|
|
296
|
+
name: faker
|
|
297
|
+
requirement: !ruby/object:Gem::Requirement
|
|
298
|
+
requirements:
|
|
299
|
+
- - ">="
|
|
300
|
+
- !ruby/object:Gem::Version
|
|
301
|
+
version: '0'
|
|
302
|
+
type: :development
|
|
303
|
+
prerelease: false
|
|
304
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
305
|
+
requirements:
|
|
306
|
+
- - ">="
|
|
307
|
+
- !ruby/object:Gem::Version
|
|
308
|
+
version: '0'
|
|
267
309
|
description: Ruby library to find ORCID IDs in the DataCite Solr index.
|
|
268
310
|
email: mfenner@datacite.org
|
|
269
311
|
executables:
|
|
@@ -293,11 +335,13 @@ files:
|
|
|
293
335
|
- spec/base_spec.rb
|
|
294
336
|
- spec/cli_spec.rb
|
|
295
337
|
- spec/datacite_related_spec.rb
|
|
338
|
+
- spec/factories/default.rb
|
|
296
339
|
- spec/fixtures/datacite_related.json
|
|
297
340
|
- spec/fixtures/datacite_related_is_identical.json
|
|
298
341
|
- spec/fixtures/datacite_related_nil.json
|
|
299
342
|
- spec/fixtures/event_data_resp_1
|
|
300
343
|
- spec/fixtures/event_data_resp_2
|
|
344
|
+
- spec/fixtures/events_empty.json
|
|
301
345
|
- spec/fixtures/orcid_update.json
|
|
302
346
|
- spec/fixtures/orcid_update_is_identical.json
|
|
303
347
|
- spec/fixtures/orcid_update_is_part.json
|
|
@@ -329,8 +373,6 @@ files:
|
|
|
329
373
|
- spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed.yml
|
|
330
374
|
- spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed_with_no_works.yml
|
|
331
375
|
- spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml
|
|
332
|
-
- spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_fail.yml
|
|
333
|
-
- spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_succeed_with_no_works.yml
|
|
334
376
|
- spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_allow_queries_by_DOI_of_the_Datacite_Metadata_Search_API.yml
|
|
335
377
|
- spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_allow_queries_by_related_identifier_of_the_Datacite_Metadata_Search_API.yml
|
|
336
378
|
- spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_report_if_there_are_no_works_returned_by_the_Datacite_Metadata_Search_API.yml
|
|
@@ -352,8 +394,13 @@ files:
|
|
|
352
394
|
- spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/queue_jobs/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml
|
|
353
395
|
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml
|
|
354
396
|
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml
|
|
397
|
+
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml
|
|
398
|
+
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml
|
|
399
|
+
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml
|
|
400
|
+
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml
|
|
355
401
|
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml
|
|
356
|
-
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/
|
|
402
|
+
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml
|
|
403
|
+
- spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml
|
|
357
404
|
- spec/orcid_update_spec.rb
|
|
358
405
|
- spec/queque_spec.rb
|
|
359
406
|
- spec/spec_helper.rb
|
|
@@ -379,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
379
426
|
version: '0'
|
|
380
427
|
requirements: []
|
|
381
428
|
rubyforge_project:
|
|
382
|
-
rubygems_version: 2.7.
|
|
429
|
+
rubygems_version: 2.7.7
|
|
383
430
|
signing_key:
|
|
384
431
|
specification_version: 4
|
|
385
432
|
summary: Ruby library to find ORCID IDs in the DataCite Solr index
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://sqs.eu-west-1.amazonaws.com/
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: Action=GetQueueUrl&QueueName=test_usage&Version=2012-11-05
|
|
9
|
-
headers:
|
|
10
|
-
Content-Type:
|
|
11
|
-
- application/x-www-form-urlencoded; charset=utf-8
|
|
12
|
-
Accept-Encoding:
|
|
13
|
-
- ''
|
|
14
|
-
User-Agent:
|
|
15
|
-
- aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
|
|
16
|
-
X-Amz-Date:
|
|
17
|
-
- 20180508T094700Z
|
|
18
|
-
X-Amz-Content-Sha256:
|
|
19
|
-
- 5761efd13dd0ed81182207171d3660628968189941431d6044920ef8fe7b1160
|
|
20
|
-
Authorization:
|
|
21
|
-
- AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180508/eu-west-1/sqs/aws4_request,
|
|
22
|
-
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=320fd5e4a16dbf0f04c65595516867443637c8f7278349c0870209eeee57cd96
|
|
23
|
-
Content-Length:
|
|
24
|
-
- '58'
|
|
25
|
-
Accept:
|
|
26
|
-
- "*/*"
|
|
27
|
-
response:
|
|
28
|
-
status:
|
|
29
|
-
code: 200
|
|
30
|
-
message: OK
|
|
31
|
-
headers:
|
|
32
|
-
Server:
|
|
33
|
-
- Server
|
|
34
|
-
Date:
|
|
35
|
-
- Tue, 08 May 2018 09:47:00 GMT
|
|
36
|
-
Content-Type:
|
|
37
|
-
- text/xml
|
|
38
|
-
Content-Length:
|
|
39
|
-
- '330'
|
|
40
|
-
Connection:
|
|
41
|
-
- keep-alive
|
|
42
|
-
X-Amzn-Requestid:
|
|
43
|
-
- 90d1e902-eb78-56b1-8e31-ba699f2cbc88
|
|
44
|
-
body:
|
|
45
|
-
encoding: UTF-8
|
|
46
|
-
string: <?xml version="1.0"?><GetQueueUrlResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><GetQueueUrlResult><QueueUrl>https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage</QueueUrl></GetQueueUrlResult><ResponseMetadata><RequestId>90d1e902-eb78-56b1-8e31-ba699f2cbc88</RequestId></ResponseMetadata></GetQueueUrlResponse>
|
|
47
|
-
http_version:
|
|
48
|
-
recorded_at: Tue, 08 May 2018 09:47:00 GMT
|
|
49
|
-
- request:
|
|
50
|
-
method: post
|
|
51
|
-
uri: https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage
|
|
52
|
-
body:
|
|
53
|
-
encoding: UTF-8
|
|
54
|
-
string: Action=GetQueueAttributes&AttributeName.1=ApproximateNumberOfMessages&AttributeName.2=ApproximateNumberOfMessagesNotVisible&QueueUrl=https%3A%2F%2Fsqs.eu-west-1.amazonaws.com%2F404017989009%2Ftest_usage&Version=2012-11-05
|
|
55
|
-
headers:
|
|
56
|
-
Content-Type:
|
|
57
|
-
- application/x-www-form-urlencoded; charset=utf-8
|
|
58
|
-
Accept-Encoding:
|
|
59
|
-
- ''
|
|
60
|
-
User-Agent:
|
|
61
|
-
- aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
|
|
62
|
-
X-Amz-Date:
|
|
63
|
-
- 20180508T094700Z
|
|
64
|
-
X-Amz-Content-Sha256:
|
|
65
|
-
- 4fa1f9790ab8d8b778fc048ef890ef00e82c1fd4658cd21964eff9eb5dc9426d
|
|
66
|
-
Authorization:
|
|
67
|
-
- AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180508/eu-west-1/sqs/aws4_request,
|
|
68
|
-
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=9bf193363d0e9d47c2286f4ca182057152c791e99f73160ff7b17f8362f5fa88
|
|
69
|
-
Content-Length:
|
|
70
|
-
- '221'
|
|
71
|
-
Accept:
|
|
72
|
-
- "*/*"
|
|
73
|
-
response:
|
|
74
|
-
status:
|
|
75
|
-
code: 200
|
|
76
|
-
message: OK
|
|
77
|
-
headers:
|
|
78
|
-
Server:
|
|
79
|
-
- Server
|
|
80
|
-
Date:
|
|
81
|
-
- Tue, 08 May 2018 09:47:00 GMT
|
|
82
|
-
Content-Type:
|
|
83
|
-
- text/xml
|
|
84
|
-
Content-Length:
|
|
85
|
-
- '446'
|
|
86
|
-
Connection:
|
|
87
|
-
- keep-alive
|
|
88
|
-
X-Amzn-Requestid:
|
|
89
|
-
- be0ad828-d22d-5165-88d7-8b43a67987ba
|
|
90
|
-
body:
|
|
91
|
-
encoding: UTF-8
|
|
92
|
-
string: <?xml version="1.0"?><GetQueueAttributesResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><GetQueueAttributesResult><Attribute><Name>ApproximateNumberOfMessages</Name><Value>0</Value></Attribute><Attribute><Name>ApproximateNumberOfMessagesNotVisible</Name><Value>0</Value></Attribute></GetQueueAttributesResult><ResponseMetadata><RequestId>be0ad828-d22d-5165-88d7-8b43a67987ba</RequestId></ResponseMetadata></GetQueueAttributesResponse>
|
|
93
|
-
http_version:
|
|
94
|
-
recorded_at: Tue, 08 May 2018 09:47:00 GMT
|
|
95
|
-
- request:
|
|
96
|
-
method: post
|
|
97
|
-
uri: "<SLACK_WEBHOOK_URL>"
|
|
98
|
-
body:
|
|
99
|
-
encoding: US-ASCII
|
|
100
|
-
string: payload=%7B%22username%22%3A%22Event+Data+Agent%22%2C%22icon_url%22%3A%22https%3A%2F%2Fraw.githubusercontent.com%2Fdatacite%2Ftoccatore%2Fmaster%2Flib%2Ftoccatore%2Fimages%2Ftoccatore.png%22%2C%22attachments%22%3A%5B%7B%22title%22%3A%22Report+for+usage_update%22%2C%22text%22%3Anull%2C%22color%22%3A%22warning%22%7D%5D%7D
|
|
101
|
-
headers:
|
|
102
|
-
Accept-Encoding:
|
|
103
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
104
|
-
Accept:
|
|
105
|
-
- "*/*"
|
|
106
|
-
User-Agent:
|
|
107
|
-
- Ruby
|
|
108
|
-
Content-Type:
|
|
109
|
-
- application/x-www-form-urlencoded
|
|
110
|
-
response:
|
|
111
|
-
status:
|
|
112
|
-
code: 200
|
|
113
|
-
message: OK
|
|
114
|
-
headers:
|
|
115
|
-
Content-Type:
|
|
116
|
-
- text/html
|
|
117
|
-
Content-Length:
|
|
118
|
-
- '22'
|
|
119
|
-
Connection:
|
|
120
|
-
- keep-alive
|
|
121
|
-
Date:
|
|
122
|
-
- Tue, 08 May 2018 09:47:00 GMT
|
|
123
|
-
Server:
|
|
124
|
-
- Apache
|
|
125
|
-
X-Slack-Backend:
|
|
126
|
-
- h
|
|
127
|
-
Referrer-Policy:
|
|
128
|
-
- no-referrer
|
|
129
|
-
Strict-Transport-Security:
|
|
130
|
-
- max-age=31536000; includeSubDomains; preload
|
|
131
|
-
X-Frame-Options:
|
|
132
|
-
- SAMEORIGIN
|
|
133
|
-
Vary:
|
|
134
|
-
- Accept-Encoding
|
|
135
|
-
Access-Control-Allow-Origin:
|
|
136
|
-
- "*"
|
|
137
|
-
X-Via:
|
|
138
|
-
- haproxy-www-cvx8
|
|
139
|
-
X-Cache:
|
|
140
|
-
- Miss from cloudfront
|
|
141
|
-
Via:
|
|
142
|
-
- 1.1 f794b89ac7b5d3a7a6b25a236579db6c.cloudfront.net (CloudFront)
|
|
143
|
-
X-Amz-Cf-Id:
|
|
144
|
-
- bkYNFP6Gnanq0lrZLB3V4BwXtCqIGV0KyyQdx_n8Qcl7CyyD0_n1wQ==
|
|
145
|
-
body:
|
|
146
|
-
encoding: ASCII-8BIT
|
|
147
|
-
string: ok
|
|
148
|
-
http_version:
|
|
149
|
-
recorded_at: Tue, 08 May 2018 09:47:00 GMT
|
|
150
|
-
recorded_with: VCR 3.0.3
|
data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_succeed_with_no_works.yml
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
http_interactions:
|
|
3
|
-
- request:
|
|
4
|
-
method: post
|
|
5
|
-
uri: https://sqs.eu-west-1.amazonaws.com/
|
|
6
|
-
body:
|
|
7
|
-
encoding: UTF-8
|
|
8
|
-
string: Action=GetQueueUrl&QueueName=test_usage&Version=2012-11-05
|
|
9
|
-
headers:
|
|
10
|
-
Content-Type:
|
|
11
|
-
- application/x-www-form-urlencoded; charset=utf-8
|
|
12
|
-
Accept-Encoding:
|
|
13
|
-
- ''
|
|
14
|
-
User-Agent:
|
|
15
|
-
- aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
|
|
16
|
-
X-Amz-Date:
|
|
17
|
-
- 20180508T094659Z
|
|
18
|
-
X-Amz-Content-Sha256:
|
|
19
|
-
- 5761efd13dd0ed81182207171d3660628968189941431d6044920ef8fe7b1160
|
|
20
|
-
Authorization:
|
|
21
|
-
- AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180508/eu-west-1/sqs/aws4_request,
|
|
22
|
-
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=5f7473224d2f7dd464748f27ffc30935f69eed31ab6b5b5ed0728fd40fce2ba2
|
|
23
|
-
Content-Length:
|
|
24
|
-
- '58'
|
|
25
|
-
Accept:
|
|
26
|
-
- "*/*"
|
|
27
|
-
response:
|
|
28
|
-
status:
|
|
29
|
-
code: 200
|
|
30
|
-
message: OK
|
|
31
|
-
headers:
|
|
32
|
-
Server:
|
|
33
|
-
- Server
|
|
34
|
-
Date:
|
|
35
|
-
- Tue, 08 May 2018 09:46:59 GMT
|
|
36
|
-
Content-Type:
|
|
37
|
-
- text/xml
|
|
38
|
-
Content-Length:
|
|
39
|
-
- '330'
|
|
40
|
-
Connection:
|
|
41
|
-
- keep-alive
|
|
42
|
-
X-Amzn-Requestid:
|
|
43
|
-
- f1a53869-39b4-551b-8328-6b024de7ba2f
|
|
44
|
-
body:
|
|
45
|
-
encoding: UTF-8
|
|
46
|
-
string: <?xml version="1.0"?><GetQueueUrlResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><GetQueueUrlResult><QueueUrl>https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage</QueueUrl></GetQueueUrlResult><ResponseMetadata><RequestId>f1a53869-39b4-551b-8328-6b024de7ba2f</RequestId></ResponseMetadata></GetQueueUrlResponse>
|
|
47
|
-
http_version:
|
|
48
|
-
recorded_at: Tue, 08 May 2018 09:46:59 GMT
|
|
49
|
-
- request:
|
|
50
|
-
method: post
|
|
51
|
-
uri: https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage
|
|
52
|
-
body:
|
|
53
|
-
encoding: UTF-8
|
|
54
|
-
string: Action=GetQueueAttributes&AttributeName.1=ApproximateNumberOfMessages&AttributeName.2=ApproximateNumberOfMessagesNotVisible&QueueUrl=https%3A%2F%2Fsqs.eu-west-1.amazonaws.com%2F404017989009%2Ftest_usage&Version=2012-11-05
|
|
55
|
-
headers:
|
|
56
|
-
Content-Type:
|
|
57
|
-
- application/x-www-form-urlencoded; charset=utf-8
|
|
58
|
-
Accept-Encoding:
|
|
59
|
-
- ''
|
|
60
|
-
User-Agent:
|
|
61
|
-
- aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
|
|
62
|
-
X-Amz-Date:
|
|
63
|
-
- 20180508T094659Z
|
|
64
|
-
X-Amz-Content-Sha256:
|
|
65
|
-
- 4fa1f9790ab8d8b778fc048ef890ef00e82c1fd4658cd21964eff9eb5dc9426d
|
|
66
|
-
Authorization:
|
|
67
|
-
- AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180508/eu-west-1/sqs/aws4_request,
|
|
68
|
-
SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=cf3ef581236b7ee88540338aa3bc6cdd604b7d9b368c5c94eed20a75184acf01
|
|
69
|
-
Content-Length:
|
|
70
|
-
- '221'
|
|
71
|
-
Accept:
|
|
72
|
-
- "*/*"
|
|
73
|
-
response:
|
|
74
|
-
status:
|
|
75
|
-
code: 200
|
|
76
|
-
message: OK
|
|
77
|
-
headers:
|
|
78
|
-
Server:
|
|
79
|
-
- Server
|
|
80
|
-
Date:
|
|
81
|
-
- Tue, 08 May 2018 09:46:59 GMT
|
|
82
|
-
Content-Type:
|
|
83
|
-
- text/xml
|
|
84
|
-
Content-Length:
|
|
85
|
-
- '446'
|
|
86
|
-
Connection:
|
|
87
|
-
- keep-alive
|
|
88
|
-
X-Amzn-Requestid:
|
|
89
|
-
- dad63327-bcc0-5db4-9612-604cc8936f6b
|
|
90
|
-
body:
|
|
91
|
-
encoding: UTF-8
|
|
92
|
-
string: <?xml version="1.0"?><GetQueueAttributesResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><GetQueueAttributesResult><Attribute><Name>ApproximateNumberOfMessages</Name><Value>0</Value></Attribute><Attribute><Name>ApproximateNumberOfMessagesNotVisible</Name><Value>0</Value></Attribute></GetQueueAttributesResult><ResponseMetadata><RequestId>dad63327-bcc0-5db4-9612-604cc8936f6b</RequestId></ResponseMetadata></GetQueueAttributesResponse>
|
|
93
|
-
http_version:
|
|
94
|
-
recorded_at: Tue, 08 May 2018 09:46:59 GMT
|
|
95
|
-
- request:
|
|
96
|
-
method: post
|
|
97
|
-
uri: "<SLACK_WEBHOOK_URL>"
|
|
98
|
-
body:
|
|
99
|
-
encoding: US-ASCII
|
|
100
|
-
string: payload=%7B%22username%22%3A%22Event+Data+Agent%22%2C%22icon_url%22%3A%22https%3A%2F%2Fraw.githubusercontent.com%2Fdatacite%2Ftoccatore%2Fmaster%2Flib%2Ftoccatore%2Fimages%2Ftoccatore.png%22%2C%22attachments%22%3A%5B%7B%22title%22%3A%22Report+for+usage_update%22%2C%22text%22%3Anull%2C%22color%22%3A%22warning%22%7D%5D%7D
|
|
101
|
-
headers:
|
|
102
|
-
Accept-Encoding:
|
|
103
|
-
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
|
104
|
-
Accept:
|
|
105
|
-
- "*/*"
|
|
106
|
-
User-Agent:
|
|
107
|
-
- Ruby
|
|
108
|
-
Content-Type:
|
|
109
|
-
- application/x-www-form-urlencoded
|
|
110
|
-
response:
|
|
111
|
-
status:
|
|
112
|
-
code: 200
|
|
113
|
-
message: OK
|
|
114
|
-
headers:
|
|
115
|
-
Content-Type:
|
|
116
|
-
- text/html
|
|
117
|
-
Content-Length:
|
|
118
|
-
- '22'
|
|
119
|
-
Connection:
|
|
120
|
-
- keep-alive
|
|
121
|
-
Date:
|
|
122
|
-
- Tue, 08 May 2018 09:47:00 GMT
|
|
123
|
-
Server:
|
|
124
|
-
- Apache
|
|
125
|
-
X-Slack-Backend:
|
|
126
|
-
- h
|
|
127
|
-
Referrer-Policy:
|
|
128
|
-
- no-referrer
|
|
129
|
-
Strict-Transport-Security:
|
|
130
|
-
- max-age=31536000; includeSubDomains; preload
|
|
131
|
-
X-Frame-Options:
|
|
132
|
-
- SAMEORIGIN
|
|
133
|
-
Vary:
|
|
134
|
-
- Accept-Encoding
|
|
135
|
-
Access-Control-Allow-Origin:
|
|
136
|
-
- "*"
|
|
137
|
-
X-Via:
|
|
138
|
-
- haproxy-www-v2r6
|
|
139
|
-
X-Cache:
|
|
140
|
-
- Miss from cloudfront
|
|
141
|
-
Via:
|
|
142
|
-
- 1.1 e98abde3c6a5bc27d4bdd4168baa587d.cloudfront.net (CloudFront)
|
|
143
|
-
X-Amz-Cf-Id:
|
|
144
|
-
- EOPeYSPwRDDHg0efem27-fUe1khpvI0655b_TRJMzl55N7m609xePw==
|
|
145
|
-
body:
|
|
146
|
-
encoding: ASCII-8BIT
|
|
147
|
-
string: ok
|
|
148
|
-
http_version:
|
|
149
|
-
recorded_at: Tue, 08 May 2018 09:47:00 GMT
|
|
150
|
-
recorded_with: VCR 3.0.3
|