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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -3
  3. data/lib/toccatore/cli.rb +1 -1
  4. data/lib/toccatore/queue.rb +8 -2
  5. data/lib/toccatore/usage_update.rb +64 -52
  6. data/lib/toccatore/version.rb +1 -1
  7. data/spec/cli_spec.rb +4 -4
  8. data/spec/datacite_related_spec.rb +1 -1
  9. data/spec/factories/default.rb +22 -0
  10. data/spec/fixtures/event_data_resp_2 +4 -4
  11. data/spec/fixtures/events_empty.json +33 -0
  12. data/spec/fixtures/usage_event.json +1 -1
  13. data/spec/fixtures/usage_event_fail.json +1 -1
  14. data/spec/fixtures/usage_events.json +8 -8
  15. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_related_identifier.yml +1 -1
  16. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml +66 -20
  17. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml +13 -13
  18. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml +13 -13
  19. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml +95 -0
  20. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml +95 -0
  21. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml +187 -0
  22. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml +52 -0
  23. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml +1039 -80
  24. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml +289 -0
  25. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml +49 -0
  26. data/spec/queque_spec.rb +44 -58
  27. data/spec/spec_helper.rb +9 -1
  28. data/spec/usage_update_spec.rb +50 -60
  29. data/toccatore.gemspec +4 -0
  30. metadata +53 -6
  31. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_fail.yml +0 -150
  32. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_succeed_with_no_works.yml +0 -150
  33. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_DataCite_Event_Data.yml +0 -199
@@ -1,199 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.test.datacite.org/events
6
- body:
7
- encoding: UTF-8
8
- string: '{"data":{"id":"393ed959-b0b2-402b-aa48-e794529b9eef","type":"events","attributes":{"message-action":"add","subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"total-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
9
- headers:
10
- User-Agent:
11
- - Maremma - https://github.com/datacite/maremma
12
- Content-Type:
13
- - application/json
14
- Accept:
15
- - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
16
- Authorization:
17
- - Bearer <LAGOTTO_TOKEN>
18
- response:
19
- status:
20
- code: 201
21
- message: ''
22
- headers:
23
- Date:
24
- - Mon, 07 May 2018 15:07:42 GMT
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Connection:
28
- - keep-alive
29
- Status:
30
- - 201 Created
31
- Cache-Control:
32
- - max-age=0, private, must-revalidate
33
- Vary:
34
- - Accept-Encoding, Origin
35
- Etag:
36
- - W/"01700b9bbf553d49a585e0fb88779627"
37
- X-Runtime:
38
- - '0.010769'
39
- X-Credential-Username:
40
- - 0000-0001-5489-3594
41
- X-Request-Id:
42
- - def01fde-6bb8-4ee1-9c03-f73772932f72
43
- X-Powered-By:
44
- - Phusion Passenger 5.2.3
45
- Server:
46
- - nginx/1.12.2 + Phusion Passenger 5.2.3
47
- body:
48
- encoding: UTF-8
49
- string: '{"data":{"id":"58b64b91-4c0e-4058-9815-ed80b7d4604a","type":"events","attributes":{"subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","obj-id":"https://doi.org/10.7291/d1q94r","message-action":"add","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","relation-type-id":"total-dataset-investigations-regular","source-id":"datacite","total":3,"license":"https://creativecommons.org/publicdomain/zero/1.0/","occurred-at":"2128-04-09T00:00:00.000Z","timestamp":"2018-05-07T15:07:42Z","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"obj":{}}}}'
50
- http_version:
51
- recorded_at: Mon, 07 May 2018 15:07:42 GMT
52
- - request:
53
- method: post
54
- uri: https://api.test.datacite.org/events
55
- body:
56
- encoding: UTF-8
57
- string: '{"data":{"id":"d4934083-0552-4e32-bed1-b103698506aa","type":"events","attributes":{"message-action":"add","subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"unique-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
58
- headers:
59
- User-Agent:
60
- - Maremma - https://github.com/datacite/maremma
61
- Content-Type:
62
- - application/json
63
- Accept:
64
- - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
65
- Authorization:
66
- - Bearer <LAGOTTO_TOKEN>
67
- response:
68
- status:
69
- code: 201
70
- message: ''
71
- headers:
72
- Date:
73
- - Mon, 07 May 2018 15:07:43 GMT
74
- Content-Type:
75
- - application/json; charset=utf-8
76
- Connection:
77
- - keep-alive
78
- Status:
79
- - 201 Created
80
- Cache-Control:
81
- - max-age=0, private, must-revalidate
82
- Vary:
83
- - Accept-Encoding, Origin
84
- Etag:
85
- - W/"5df37219e0abe7356435e8ad2c7d359f"
86
- X-Runtime:
87
- - '0.010413'
88
- X-Credential-Username:
89
- - 0000-0001-5489-3594
90
- X-Request-Id:
91
- - c86c445e-ffa4-4f8a-8a5c-64567b0ac8b9
92
- X-Powered-By:
93
- - Phusion Passenger 5.2.3
94
- Server:
95
- - nginx/1.12.2 + Phusion Passenger 5.2.3
96
- body:
97
- encoding: UTF-8
98
- string: '{"data":{"id":"5c4edbd7-3308-46d8-b018-4412988868f9","type":"events","attributes":{"subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","obj-id":"https://doi.org/10.7291/d1q94r","message-action":"add","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","relation-type-id":"unique-dataset-investigations-regular","source-id":"datacite","total":3,"license":"https://creativecommons.org/publicdomain/zero/1.0/","occurred-at":"2128-04-09T00:00:00.000Z","timestamp":"2018-05-07T15:07:43Z","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"obj":{}}}}'
99
- http_version:
100
- recorded_at: Mon, 07 May 2018 15:07:43 GMT
101
- - request:
102
- method: post
103
- uri: https://api.test.datacite.org/events
104
- body:
105
- encoding: UTF-8
106
- string: '{"data":{"id":"393ed959-b0b2-402b-aa48-e794529b9eef","type":"events","attributes":{"message-action":"add","subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"total-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
107
- headers:
108
- User-Agent:
109
- - Maremma - https://github.com/datacite/maremma
110
- Content-Type:
111
- - application/json
112
- Accept:
113
- - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
114
- Authorization:
115
- - Bearer <LAGOTTO_TOKEN>
116
- response:
117
- status:
118
- code: 201
119
- message: ''
120
- headers:
121
- Date:
122
- - Mon, 07 May 2018 15:07:43 GMT
123
- Content-Type:
124
- - application/json; charset=utf-8
125
- Connection:
126
- - keep-alive
127
- Status:
128
- - 201 Created
129
- Cache-Control:
130
- - max-age=0, private, must-revalidate
131
- Vary:
132
- - Accept-Encoding, Origin
133
- Etag:
134
- - W/"47258fc20a829faf79620c607b4b5e02"
135
- X-Runtime:
136
- - '0.010351'
137
- X-Credential-Username:
138
- - 0000-0001-5489-3594
139
- X-Request-Id:
140
- - e41d3e47-d6ff-46d4-9b37-bf80b5c485fe
141
- X-Powered-By:
142
- - Phusion Passenger 5.2.3
143
- Server:
144
- - nginx/1.12.2 + Phusion Passenger 5.2.3
145
- body:
146
- encoding: UTF-8
147
- string: '{"data":{"id":"8fde079c-f919-4d7f-96cb-e74e861c09e3","type":"events","attributes":{"subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","obj-id":"https://doi.org/10.7291/d1q94r","message-action":"add","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","relation-type-id":"total-dataset-investigations-regular","source-id":"datacite","total":3,"license":"https://creativecommons.org/publicdomain/zero/1.0/","occurred-at":"2128-04-09T00:00:00.000Z","timestamp":"2018-05-07T15:07:43Z","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"obj":{}}}}'
148
- http_version:
149
- recorded_at: Mon, 07 May 2018 15:07:43 GMT
150
- - request:
151
- method: post
152
- uri: https://api.test.datacite.org/events
153
- body:
154
- encoding: UTF-8
155
- string: '{"data":{"id":"d4934083-0552-4e32-bed1-b103698506aa","type":"events","attributes":{"message-action":"add","subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"unique-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
156
- headers:
157
- User-Agent:
158
- - Maremma - https://github.com/datacite/maremma
159
- Content-Type:
160
- - application/json
161
- Accept:
162
- - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
163
- Authorization:
164
- - Bearer <LAGOTTO_TOKEN>
165
- response:
166
- status:
167
- code: 201
168
- message: ''
169
- headers:
170
- Date:
171
- - Mon, 07 May 2018 15:07:43 GMT
172
- Content-Type:
173
- - application/json; charset=utf-8
174
- Connection:
175
- - keep-alive
176
- Status:
177
- - 201 Created
178
- Cache-Control:
179
- - max-age=0, private, must-revalidate
180
- Vary:
181
- - Accept-Encoding, Origin
182
- Etag:
183
- - W/"ccb671619889c6d8d1340da3814ef0a0"
184
- X-Runtime:
185
- - '0.010571'
186
- X-Credential-Username:
187
- - 0000-0001-5489-3594
188
- X-Request-Id:
189
- - 3504a0cb-d384-490d-922f-15dbf095c42d
190
- X-Powered-By:
191
- - Phusion Passenger 5.2.3
192
- Server:
193
- - nginx/1.12.2 + Phusion Passenger 5.2.3
194
- body:
195
- encoding: UTF-8
196
- string: '{"data":{"id":"b14650aa-817e-4922-a06d-27d6a21a9920","type":"events","attributes":{"subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dash","obj-id":"https://doi.org/10.7291/d1q94r","message-action":"add","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","relation-type-id":"unique-dataset-investigations-regular","source-id":"datacite","total":3,"license":"https://creativecommons.org/publicdomain/zero/1.0/","occurred-at":"2128-04-09T00:00:00.000Z","timestamp":"2018-05-07T15:07:43Z","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"obj":{}}}}'
197
- http_version:
198
- recorded_at: Mon, 07 May 2018 15:07:43 GMT
199
- recorded_with: VCR 3.0.3