toccatore 0.4.0 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +8 -1
  3. data/lib/toccatore/cli.rb +1 -1
  4. data/lib/toccatore/queue.rb +6 -2
  5. data/lib/toccatore/usage_update.rb +37 -31
  6. data/lib/toccatore/version.rb +1 -1
  7. data/spec/cli_spec.rb +2 -2
  8. data/spec/factories/default.rb +22 -0
  9. data/spec/fixtures/event_data_resp_2 +4 -4
  10. data/spec/fixtures/usage_events.json +4 -4
  11. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml +120 -28
  12. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml +6 -6
  13. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml +6 -6
  14. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml +95 -0
  15. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml +95 -0
  16. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml +187 -0
  17. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml +1045 -80
  18. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_fail_if_the_queue_doesn_exist.yml +49 -0
  19. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml +49 -0
  20. data/spec/queque_spec.rb +44 -58
  21. data/spec/spec_helper.rb +7 -0
  22. data/spec/usage_update_spec.rb +21 -12
  23. data/toccatore.gemspec +4 -0
  24. metadata +50 -5
  25. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_fail.yml +0 -150
  26. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_succeed_with_no_works.yml +0 -150
  27. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_DataCite_Event_Data.yml +0 -199
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b4f98467d1df1b0ce5226b887a5cd1d5b9e3fb551bfc631e9857fca366ee7d29
4
- data.tar.gz: fd8c901be0ee18936711f73e959e19cee8e9ecdf114df8b6372af83e2e8922e5
3
+ metadata.gz: 0cb6715e4b1f6670be94c0856acc321bc098f764c5d69c7a20c3f0bc97a496aa
4
+ data.tar.gz: cff0f6962c115beec2264401db53c822291c1b062aee2cf33db89e93abd2d251
5
5
  SHA512:
6
- metadata.gz: 5e3f4a9db657604571d0be6f45222e8bae2a7b7c6c5e0945cf7aeb6aec0099d0caaa0f210665d2fa7c9f88a8dc74e5c9e4f4e2326b29df0332d93fd3d93e51e7
7
- data.tar.gz: f81581346057dbe1e0d0e25c37bdfa2be5cf4ba00c59f5da36cb606a0806085c7a6b47724939e5fb032a93aa153090cf17b6c55d426e8480b61ebb5a5e99bebe
6
+ metadata.gz: 1513263252c59c07e13f9d89909ad62b99a91b6ddd05a1bd2ad310851b92362d3d74608981dd5370bd8a4265e7b7ebc63a063678a47c6598c71fa0e1158fa4c9
7
+ data.tar.gz: 401fb2e8feba5d5817e4bd20c959cc72e2f5458d20933084a58e6fe681bfc1e8d90ca666b6111971d2f8ab1767557db38254f4b78631f95c71953a15e8d26e29
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- toccatore (0.4.0)
4
+ toccatore (0.4.2)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  aws-sdk-sqs
7
7
  dotenv (~> 2.1, >= 2.1.1)
8
+ factory_bot
8
9
  gender_detector (~> 1.0)
9
10
  maremma (~> 3.5)
10
11
  namae (~> 0.11.0)
@@ -40,6 +41,10 @@ GEM
40
41
  docile (1.1.5)
41
42
  dotenv (2.4.0)
42
43
  excon (0.45.4)
44
+ factory_bot (4.8.2)
45
+ activesupport (>= 3.0.0)
46
+ faker (1.8.7)
47
+ i18n (>= 0.7)
43
48
  faraday (0.9.2)
44
49
  multipart-post (>= 1.2, < 3)
45
50
  faraday-encoding (0.0.4)
@@ -112,6 +117,8 @@ PLATFORMS
112
117
  DEPENDENCIES
113
118
  bundler (~> 1.0)
114
119
  codeclimate-test-reporter (~> 1.0, >= 1.0.0)
120
+ factory_bot
121
+ faker
115
122
  rack-test (~> 0)
116
123
  rake (~> 12.0)
117
124
  rspec (~> 3.4)
data/lib/toccatore/cli.rb CHANGED
@@ -53,7 +53,7 @@ module Toccatore
53
53
  method_option :push_url, type: :string
54
54
  method_option :slack_webhook_url, type: :string
55
55
  method_option :doi, type: :string
56
- method_option :jsonapi, :type => :boolean, :force => true
56
+ method_option :jsonapi, :type => :boolean, default: true
57
57
  def usage_update
58
58
  usage_update = Toccatore::UsageUpdate.new
59
59
  usage_update.queue_jobs(usage_update.unfreeze(options))
@@ -4,7 +4,8 @@ module Toccatore
4
4
  module Queue
5
5
 
6
6
  def queue options={}
7
- Aws::SQS::Client.new(region: ENV['AWS_REGION'].to_s, stub_responses: false)
7
+ region = ENV['AWS_REGION'] ||= 'eu-west-1'
8
+ Aws::SQS::Client.new(region: region.to_s, stub_responses: false)
8
9
  end
9
10
 
10
11
  def get_total options={}
@@ -28,6 +29,7 @@ module Toccatore
28
29
  end
29
30
 
30
31
  def delete_message options={}
32
+ return 1 if options.messages.size < 1
31
33
  reponse = @sqs.delete_message({
32
34
  queue_url: queue_url,
33
35
  receipt_handle: options.messages[0][:receipt_handle]
@@ -43,7 +45,9 @@ module Toccatore
43
45
  end
44
46
 
45
47
  def queue_url options={}
46
- queue_name = queue_name ||= "#{ENV['ENVIROMENT']}_usage"
48
+ options[:queue_name] ||= "#{ENV['ENVIRONMENT']}_usage" || "stage_usage"
49
+ queue_name = options[:queue_name]
50
+ # puts "Using #{@sqs.get_queue_url(queue_name: queue_name).queue_url} queue"
47
51
  @sqs.get_queue_url(queue_name: queue_name).queue_url
48
52
  end
49
53
  end
@@ -19,18 +19,19 @@ module Toccatore
19
19
  text = "No works found for in the Usage Reports Queue."
20
20
  end
21
21
 
22
- while total > 0
22
+ error_total = 0
23
+ num_messages = total
24
+ while num_messages > 0
23
25
  # walk through paginated results
24
- total_pages = (total.to_f / job_batch_size).ceil
25
- error_total = 0
26
-
27
- (0...total_pages).each do |page|
28
- options[:offset] = page * job_batch_size
29
- options[:total] = total
26
+
27
+ # (0...total).each do |page|
28
+ # options[:offset] = page * 1
29
+ # options[:total] = total
30
30
  error_total += process_data(options)
31
- end
32
- text = "#{total} works processed with #{error_total} errors for Usage Reports Queue"
31
+ num_messages = get_total(options)
32
+ # end
33
33
  end
34
+ text = "#{num_messages} works processed with #{error_total} errors for Usage Reports Queue"
34
35
 
35
36
  puts text
36
37
  # send slack notification
@@ -39,7 +40,7 @@ module Toccatore
39
40
  send_notification_to_slack(text, options) if options[:slack_webhook_url].present?
40
41
 
41
42
  # return number of works queued
42
- total
43
+ get_total(options)
43
44
  end
44
45
 
45
46
  def process_data(options = {})
@@ -49,8 +50,11 @@ module Toccatore
49
50
 
50
51
  return [OpenStruct.new(body: { "data" => [] })] if data.empty?
51
52
 
52
- push_data(data, options)
53
- delete_message message
53
+ errors = push_data(data, options)
54
+ if errors < 1
55
+ delete_message message
56
+ end
57
+ errors
54
58
  end
55
59
 
56
60
  def get_data reponse
@@ -87,7 +91,7 @@ module Toccatore
87
91
  end
88
92
 
89
93
  def format_event type, data, options
90
- { "id" => SecureRandom.uuid,
94
+ { "uuid" => SecureRandom.uuid,
91
95
  "message-action" => "add",
92
96
  "subj-id" => data[:report_id],
93
97
  "subj"=> {
@@ -136,30 +140,32 @@ module Toccatore
136
140
 
137
141
  def push_item(item, options={})
138
142
  return OpenStruct.new(body: { "errors" => [{ "title" => "Access token missing." }] }) if options[:access_token].blank?
143
+ return 0 if item == "Queue is empty"
139
144
 
140
145
  host = options[:push_url].presence || "https://api.test.datacite.org"
141
- push_url = host + "/events"
142
-
143
- if options[:jsonapi]
144
- data = { "data" => {
145
- "id" => item["id"],
146
- "type" => "events",
147
- "attributes" => item.except("id") }}
148
- response = Maremma.post(push_url, data: data.to_json,
149
- bearer: options[:access_token],
150
- content_type: 'json',
151
- host: host)
152
- else
153
- response = Maremma.post(push_url, data: item.to_json,
154
- bearer: options[:access_token],
155
- content_type: 'json',
156
- host: host)
157
- end
146
+ push_url = host + "/events/" + item["uuid"].to_s
147
+ data = { "data" => {
148
+ "id" => item["uuid"],
149
+ "type" => "events",
150
+ "attributes" => item.except("id") }}
151
+ response = Maremma.put(push_url, data: data.to_json,
152
+ bearer: options[:access_token],
153
+ content_type: 'json',
154
+ host: host)
155
+ # else
156
+ # response = Maremma.post(push_url, data: item.to_json,
157
+ # bearer: options[:access_token],
158
+ # content_type: 'json',
159
+ # host: host)
160
+ # end
158
161
 
159
162
  # return 0 if successful, 1 if error
160
- if response.status == 201
163
+ if response.status == 201
161
164
  puts "#{item['subj-id']} #{item['relation-type-id']} #{item['obj-id']} pushed to Event Data service."
162
165
  0
166
+ elsif response.status == 200
167
+ puts "#{item['subj-id']} #{item['relation-type-id']} #{item['obj-id']} pushed to Event Data service for update."
168
+ 0
163
169
  elsif response.body["errors"].present?
164
170
  puts "#{item['subj-id']} #{item['relation-type-id']} #{item['obj-id']} had an error:"
165
171
  puts "#{response.body['errors'].first['title']}"
@@ -1,3 +1,3 @@
1
1
  module Toccatore
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -8,7 +8,7 @@ describe Toccatore::CLI do
8
8
 
9
9
  describe "version" do
10
10
  it 'has version' do
11
- expect { subject.__print_version }.to output("0.4.0\n").to_stdout
11
+ expect { subject.__print_version }.to output("0.4.2\n").to_stdout
12
12
  end
13
13
  end
14
14
 
@@ -123,7 +123,7 @@ describe Toccatore::CLI do
123
123
  subject.options = { push_url: push_url,
124
124
  slack_webhook_url: slack_webhook_url,
125
125
  access_token: access_token}
126
- expect { subject.usage_update }.to output("No works found for in the Usage Reports Queue.\n").to_stdout
126
+ expect { subject.usage_update }.to output("0 works processed with 0 errors for Usage Reports Queue\n").to_stdout
127
127
  end
128
128
  end
129
129
 
@@ -0,0 +1,22 @@
1
+ require "faker"
2
+ require 'securerandom'
3
+
4
+
5
+ FactoryBot.define do
6
+ factory :event , class: OpenStruct do
7
+ sequence(:uuid) { |n| "#{SecureRandom.uuid}-#{n}" }
8
+ message_action "add"
9
+ sequence(:obj_id) { |n| "#{Faker::Internet.url}#{n}" }
10
+ sequence(:subj_id) { |n| "#{Faker::Internet.url}#{n}" }
11
+ total Faker::Number.number(3)
12
+ subj {{
13
+ "pid" => "fdfdfd",
14
+ "issued" => Faker::Time.between(DateTime.now - 2, DateTime.now),
15
+ }}
16
+ relation_type_id ["total-dataset-investigations-regular","total-dataset-investigations-machine","unique-dataset-investigations-machine","total-dataset-investigations-machine"].sample
17
+ source_id "datacite-usage"
18
+ sequence(:source_token) { |n| "#{SecureRandom.uuid}-#{n}" }
19
+ occurred_at Faker::Time.between(DateTime.now - 2, DateTime.now)
20
+ license "https://creativecommons.org/publicdomain/zero/1.0/"
21
+ end
22
+ end
@@ -1,4 +1,4 @@
1
- https://metrics.test.datacite.org/reports/2018-3-Dash total-dataset-investigations-regular https://doi.org/10.7291/d1q94r pushed to Event Data service.
2
- https://metrics.test.datacite.org/reports/2018-3-Dash unique-dataset-investigations-regular https://doi.org/10.7291/d1q94r pushed to Event Data service.
3
- https://metrics.test.datacite.org/reports/2018-3-Dash Total-Dataset-Requests-Machine https://doi.org/10.6071/z7wc73 pushed to Event Data service.
4
- https://metrics.test.datacite.org/reports/2018-3-Dash Unique-Dataset-Requests-Machine https://doi.org/10.6071/z7wc73 pushed to Event Data service.
1
+ https://metrics.test.datacite.org/reports/2018-3-Dash total-dataset-investigations-regular https://doi.org/10.7291/d1q94r had an error:\nthe server responded with status 500/\n
2
+ https://metrics.test.datacite.org/reports/2018-3-Dash unique-dataset-investigations-regular https://doi.org/10.7291/d1q94r had an error:\nthe server responded with status 500/\n
3
+ https://metrics.test.datacite.org/reports/2018-3-Dash Total-Dataset-Requests-Machine https://doi.org/10.6071/z7wc73 had an error:\nthe server responded with status 500/\n
4
+ https://metrics.test.datacite.org/reports/2018-3-Dash Unique-Dataset-Requests-Machine https://doi.org/10.6071/z7wc73 had an error:\nthe server responded with status 500/\n
@@ -1,6 +1,6 @@
1
1
  [
2
2
  {
3
- "id": "a17e783b-8214-451e-9b0d-077213c2acae",
3
+ "uuid": "a17e783b-8214-451e-9b0d-077213c2acae",
4
4
  "message-action": "add",
5
5
  "subj-id": "https://metrics.test.datacite.org/reports/2018-3-Dash",
6
6
  "subj": {
@@ -15,7 +15,7 @@
15
15
  "occurred-at": "2128-04-09",
16
16
  "license": "https://creativecommons.org/publicdomain/zero/1.0/"
17
17
  }, {
18
- "id": "fc6860b8-4230-41bc-8b8e-21d60e9a7d9a",
18
+ "uuid": "fc6860b8-4230-41bc-8b8e-21d60e9a7d9a",
19
19
  "message-action": "add",
20
20
  "subj-id": "https://metrics.test.datacite.org/reports/2018-3-Dash",
21
21
  "subj": {
@@ -30,7 +30,7 @@
30
30
  "occurred-at": "2128-04-09",
31
31
  "license": "https://creativecommons.org/publicdomain/zero/1.0/"
32
32
  }, {
33
- "id": "054da0ad-9821-492e-877e-5c3adbfd5ccf",
33
+ "uuid": "054da0ad-9821-492e-877e-5c3adbfd5ccf",
34
34
  "message-action": "add",
35
35
  "subj-id": "https://metrics.test.datacite.org/reports/2018-3-Dash",
36
36
  "subj": {
@@ -45,7 +45,7 @@
45
45
  "occurred-at": "2128-04-09",
46
46
  "license": "https://creativecommons.org/publicdomain/zero/1.0/"
47
47
  }, {
48
- "id": "6d6fd620-2123-42da-91f3-6c02e63f3cec",
48
+ "uuid": "6d6fd620-2123-42da-91f3-6c02e63f3cec",
49
49
  "message-action": "add",
50
50
  "subj-id": "https://metrics.test.datacite.org/reports/2018-3-Dash",
51
51
  "subj": {
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: https://sqs.eu-west-1.amazonaws.com/
6
6
  body:
7
7
  encoding: UTF-8
8
- string: Action=GetQueueUrl&QueueName=test_usage&Version=2012-11-05
8
+ string: Action=GetQueueUrl&QueueName=stage_usage&Version=2012-11-05
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/x-www-form-urlencoded; charset=utf-8
@@ -14,14 +14,14 @@ http_interactions:
14
14
  User-Agent:
15
15
  - aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
16
16
  X-Amz-Date:
17
- - 20180508T103005Z
17
+ - 20180517T135353Z
18
18
  X-Amz-Content-Sha256:
19
- - 5761efd13dd0ed81182207171d3660628968189941431d6044920ef8fe7b1160
19
+ - 5034a1b0b889e68da64b7a052e782d357595681cff3bfea21cac68581dec9836
20
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=64ba16e1f33bae2a1571ef2dfde579e6970cfa8693ecca0126e825b4870e9e8c
21
+ - AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180517/eu-west-1/sqs/aws4_request,
22
+ SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=bebc3d0da820ae3bd911134080ed6461359fd357bce937b15580b1107e73e94b
23
23
  Content-Length:
24
- - '58'
24
+ - '59'
25
25
  Accept:
26
26
  - "*/*"
27
27
  response:
@@ -32,26 +32,26 @@ http_interactions:
32
32
  Server:
33
33
  - Server
34
34
  Date:
35
- - Tue, 08 May 2018 10:30:06 GMT
35
+ - Thu, 17 May 2018 13:53:53 GMT
36
36
  Content-Type:
37
37
  - text/xml
38
38
  Content-Length:
39
- - '330'
39
+ - '331'
40
40
  Connection:
41
41
  - keep-alive
42
42
  X-Amzn-Requestid:
43
- - 41e1b46e-d509-52d1-8d62-e705ab67c01a
43
+ - bc0893f6-562e-544a-9a6f-c081dd9fba5e
44
44
  body:
45
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>41e1b46e-d509-52d1-8d62-e705ab67c01a</RequestId></ResponseMetadata></GetQueueUrlResponse>
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/stage_usage</QueueUrl></GetQueueUrlResult><ResponseMetadata><RequestId>bc0893f6-562e-544a-9a6f-c081dd9fba5e</RequestId></ResponseMetadata></GetQueueUrlResponse>
47
47
  http_version:
48
- recorded_at: Tue, 08 May 2018 10:30:06 GMT
48
+ recorded_at: Thu, 17 May 2018 13:53:54 GMT
49
49
  - request:
50
50
  method: post
51
- uri: https://sqs.eu-west-1.amazonaws.com/404017989009/test_usage
51
+ uri: https://sqs.eu-west-1.amazonaws.com/404017989009/stage_usage
52
52
  body:
53
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
54
+ string: Action=GetQueueAttributes&AttributeName.1=ApproximateNumberOfMessages&AttributeName.2=ApproximateNumberOfMessagesNotVisible&QueueUrl=https%3A%2F%2Fsqs.eu-west-1.amazonaws.com%2F404017989009%2Fstage_usage&Version=2012-11-05
55
55
  headers:
56
56
  Content-Type:
57
57
  - application/x-www-form-urlencoded; charset=utf-8
@@ -60,14 +60,14 @@ http_interactions:
60
60
  User-Agent:
61
61
  - aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
62
62
  X-Amz-Date:
63
- - 20180508T103006Z
63
+ - 20180517T135354Z
64
64
  X-Amz-Content-Sha256:
65
- - 4fa1f9790ab8d8b778fc048ef890ef00e82c1fd4658cd21964eff9eb5dc9426d
65
+ - 96a6d2cb54f526d279e954a56182b68f10b0ee5e7a64bc951623176e816b2435
66
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=1150f8f5456b041990e00a58f96be8ff5fc1cad94a21d75ffd45901d4062360d
67
+ - AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180517/eu-west-1/sqs/aws4_request,
68
+ SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=90fb080b0ba9bc6fe3181e653cbd8961faf5923a5bccd72e6edfb611f8297cb2
69
69
  Content-Length:
70
- - '221'
70
+ - '222'
71
71
  Accept:
72
72
  - "*/*"
73
73
  response:
@@ -78,7 +78,7 @@ http_interactions:
78
78
  Server:
79
79
  - Server
80
80
  Date:
81
- - Tue, 08 May 2018 10:30:06 GMT
81
+ - Thu, 17 May 2018 13:53:54 GMT
82
82
  Content-Type:
83
83
  - text/xml
84
84
  Content-Length:
@@ -86,18 +86,18 @@ http_interactions:
86
86
  Connection:
87
87
  - keep-alive
88
88
  X-Amzn-Requestid:
89
- - 20a02d4c-100d-55c7-bbe9-7e276e6354cc
89
+ - c1a29456-465b-53ae-aebc-c721cde986e3
90
90
  body:
91
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>20a02d4c-100d-55c7-bbe9-7e276e6354cc</RequestId></ResponseMetadata></GetQueueAttributesResponse>
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>c1a29456-465b-53ae-aebc-c721cde986e3</RequestId></ResponseMetadata></GetQueueAttributesResponse>
93
93
  http_version:
94
- recorded_at: Tue, 08 May 2018 10:30:06 GMT
94
+ recorded_at: Thu, 17 May 2018 13:53:54 GMT
95
95
  - request:
96
96
  method: post
97
97
  uri: "<SLACK_WEBHOOK_URL>"
98
98
  body:
99
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%3A%22No+works+found+for+in+the+Usage+Reports+Queue.%22%2C%22color%22%3A%22warning%22%7D%5D%7D
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%3A%220+works+processed+with+0+errors+for+Usage+Reports+Queue%22%2C%22color%22%3A%22warning%22%7D%5D%7D
101
101
  headers:
102
102
  Accept-Encoding:
103
103
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
@@ -119,7 +119,7 @@ http_interactions:
119
119
  Connection:
120
120
  - keep-alive
121
121
  Date:
122
- - Tue, 08 May 2018 10:30:06 GMT
122
+ - Thu, 17 May 2018 13:53:54 GMT
123
123
  Server:
124
124
  - Apache
125
125
  X-Slack-Backend:
@@ -135,16 +135,108 @@ http_interactions:
135
135
  Access-Control-Allow-Origin:
136
136
  - "*"
137
137
  X-Via:
138
- - haproxy-www-ti0y
138
+ - haproxy-www-7xdi
139
139
  X-Cache:
140
140
  - Miss from cloudfront
141
141
  Via:
142
- - 1.1 8e7b38fb8c27e98caec113dfa99daa1a.cloudfront.net (CloudFront)
142
+ - 1.1 9bb7bac3df4ba5eb70e607f6fa98eab8.cloudfront.net (CloudFront)
143
143
  X-Amz-Cf-Id:
144
- - mbliRIKKiAQjGo9tR4VjqK8IZTKtq0EK3p7-D2JxFlYWtziVB5gJfw==
144
+ - Upbb1emQ0p1Da2EjO_ivEA_ZY5XE3j2hqc39PamDfqGKQCian2SBKw==
145
145
  body:
146
146
  encoding: ASCII-8BIT
147
147
  string: ok
148
148
  http_version:
149
- recorded_at: Tue, 08 May 2018 10:30:06 GMT
149
+ recorded_at: Thu, 17 May 2018 13:53:54 GMT
150
+ - request:
151
+ method: post
152
+ uri: https://sqs.eu-west-1.amazonaws.com/
153
+ body:
154
+ encoding: UTF-8
155
+ string: Action=GetQueueUrl&QueueName=stage_usage&Version=2012-11-05
156
+ headers:
157
+ Content-Type:
158
+ - application/x-www-form-urlencoded; charset=utf-8
159
+ Accept-Encoding:
160
+ - ''
161
+ User-Agent:
162
+ - aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
163
+ X-Amz-Date:
164
+ - 20180517T135354Z
165
+ X-Amz-Content-Sha256:
166
+ - 5034a1b0b889e68da64b7a052e782d357595681cff3bfea21cac68581dec9836
167
+ Authorization:
168
+ - AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180517/eu-west-1/sqs/aws4_request,
169
+ SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=62b57367ad5be273f2a3001f081487440a655bc427b12dbe22a5863e2454e8e3
170
+ Content-Length:
171
+ - '59'
172
+ Accept:
173
+ - "*/*"
174
+ response:
175
+ status:
176
+ code: 200
177
+ message: OK
178
+ headers:
179
+ Server:
180
+ - Server
181
+ Date:
182
+ - Thu, 17 May 2018 13:53:54 GMT
183
+ Content-Type:
184
+ - text/xml
185
+ Content-Length:
186
+ - '331'
187
+ Connection:
188
+ - keep-alive
189
+ X-Amzn-Requestid:
190
+ - c9b352e6-b1e8-5fd3-ac17-01913a5a2afc
191
+ body:
192
+ encoding: UTF-8
193
+ 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/stage_usage</QueueUrl></GetQueueUrlResult><ResponseMetadata><RequestId>c9b352e6-b1e8-5fd3-ac17-01913a5a2afc</RequestId></ResponseMetadata></GetQueueUrlResponse>
194
+ http_version:
195
+ recorded_at: Thu, 17 May 2018 13:53:54 GMT
196
+ - request:
197
+ method: post
198
+ uri: https://sqs.eu-west-1.amazonaws.com/404017989009/stage_usage
199
+ body:
200
+ encoding: UTF-8
201
+ string: Action=GetQueueAttributes&AttributeName.1=ApproximateNumberOfMessages&AttributeName.2=ApproximateNumberOfMessagesNotVisible&QueueUrl=https%3A%2F%2Fsqs.eu-west-1.amazonaws.com%2F404017989009%2Fstage_usage&Version=2012-11-05
202
+ headers:
203
+ Content-Type:
204
+ - application/x-www-form-urlencoded; charset=utf-8
205
+ Accept-Encoding:
206
+ - ''
207
+ User-Agent:
208
+ - aws-sdk-ruby3/3.20.2 ruby/2.3.3 x86_64-darwin15 aws-sdk-sqs/1.3.0
209
+ X-Amz-Date:
210
+ - 20180517T135354Z
211
+ X-Amz-Content-Sha256:
212
+ - 96a6d2cb54f526d279e954a56182b68f10b0ee5e7a64bc951623176e816b2435
213
+ Authorization:
214
+ - AWS4-HMAC-SHA256 Credential=AKIAIXLDUBIDM74CC6KQ/20180517/eu-west-1/sqs/aws4_request,
215
+ SignedHeaders=content-type;host;x-amz-content-sha256;x-amz-date, Signature=90fb080b0ba9bc6fe3181e653cbd8961faf5923a5bccd72e6edfb611f8297cb2
216
+ Content-Length:
217
+ - '222'
218
+ Accept:
219
+ - "*/*"
220
+ response:
221
+ status:
222
+ code: 200
223
+ message: OK
224
+ headers:
225
+ Server:
226
+ - Server
227
+ Date:
228
+ - Thu, 17 May 2018 13:53:54 GMT
229
+ Content-Type:
230
+ - text/xml
231
+ Content-Length:
232
+ - '446'
233
+ Connection:
234
+ - keep-alive
235
+ X-Amzn-Requestid:
236
+ - 793887b1-401d-5680-9d0a-d4c6cbafdcc9
237
+ body:
238
+ encoding: UTF-8
239
+ 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>793887b1-401d-5680-9d0a-d4c6cbafdcc9</RequestId></ResponseMetadata></GetQueueAttributesResponse>
240
+ http_version:
241
+ recorded_at: Thu, 17 May 2018 13:53:54 GMT
150
242
  recorded_with: VCR 3.0.3