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
@@ -0,0 +1,52 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: put
5
+ uri: https://api.test.datacite.org/events/fc6860b8-4230-41bc-8b8e-21d60e9a7d9a
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"data":{"id":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","type":"events","attributes":{"uuid":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","message-action":"add","subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dashs","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dashs","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":"43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc","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
+ - Sun, 27 May 2018 17:51:47 GMT
25
+ Content-Type:
26
+ - application/vnd.api+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/"1893292a0294f3ba4368bce947c7f67b"
37
+ X-Runtime:
38
+ - '0.016660'
39
+ X-Credential-Username:
40
+ - 0000-0001-5489-3594
41
+ X-Request-Id:
42
+ - 8018d1a4-7e0c-479e-b8aa-161abfe6b343
43
+ X-Powered-By:
44
+ - Phusion Passenger 5.3.1
45
+ Server:
46
+ - nginx/1.14.0 + Phusion Passenger 5.3.1
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"data":{"id":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","type":"events","attributes":{"subj-id":"https://metrics.test.datacite.org/reports/2018-3-Dashs","obj-id":"https://doi.org/10.7291/d1q94r","message-action":"add","source-token":"43ba99ae-5cf0-11e8-9c2d-fa7ae01bbebc","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-27T17:51:47Z","subj":{"pid":"https://metrics.test.datacite.org/reports/2018-3-Dashs","issued":"2128-04-09"},"obj":{}}}}'
50
+ http_version:
51
+ recorded_at: Sun, 27 May 2018 17:51:47 GMT
52
+ recorded_with: VCR 3.0.3