toccatore 0.3.9 → 0.4.15

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 (78) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +76 -54
  3. data/README.md +1 -1
  4. data/lib/toccatore/base.rb +15 -4
  5. data/lib/toccatore/cli.rb +12 -0
  6. data/lib/toccatore/datacite_related.rb +18 -3
  7. data/lib/toccatore/orcid_update.rb +6 -2
  8. data/lib/toccatore/queue.rb +56 -0
  9. data/lib/toccatore/usage_update.rb +183 -0
  10. data/lib/toccatore/version.rb +1 -1
  11. data/lib/toccatore.rb +2 -0
  12. data/spec/base_spec.rb +4 -4
  13. data/spec/cli_spec.rb +36 -3
  14. data/spec/datacite_related_spec.rb +10 -10
  15. data/spec/factories/default.rb +22 -0
  16. data/spec/fixtures/event_data_resp_1 +2 -0
  17. data/spec/fixtures/event_data_resp_2 +4 -0
  18. data/spec/fixtures/events_empty.json +33 -0
  19. data/spec/fixtures/usage_event.json +1 -0
  20. data/spec/fixtures/usage_event_fail.json +17 -0
  21. data/spec/fixtures/usage_events.json +63 -0
  22. data/spec/fixtures/usage_update.json +101 -0
  23. data/spec/fixtures/usage_update_1.json +36738 -0
  24. data/spec/fixtures/usage_update_2.json +171 -0
  25. data/spec/fixtures/usage_update_3.json +176 -0
  26. data/spec/fixtures/usage_update_4.json +101 -0
  27. data/spec/fixtures/usage_update_nil.json +6 -0
  28. data/spec/fixtures/vcr_cassettes/Toccatore_Base/get_doi_ra/crossref.yml +21 -45
  29. data/spec/fixtures/vcr_cassettes/Toccatore_Base/get_doi_ra/datacite.yml +23 -47
  30. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related.yml +14 -12
  31. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related_no_works.yml +15 -13
  32. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/orcid_update.yml +14 -12
  33. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/orcid_update_no_works.yml +15 -13
  34. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_fail.yml +345 -852
  35. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_DOI.yml +327 -409
  36. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_related_identifier.yml +140 -117
  37. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_succeed.yml +1267 -2068
  38. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_succeed_with_no_works.yml +31 -25
  39. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_fail.yml +47 -39
  40. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_DOI.yml +673 -855
  41. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_ORCID_ID.yml +1885 -2419
  42. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed.yml +1555 -1991
  43. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed_with_no_works.yml +31 -27
  44. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml +196 -0
  45. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_allow_queries_by_DOI_of_the_Datacite_Metadata_Search_API.yml +16 -12
  46. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_allow_queries_by_related_identifier_of_the_Datacite_Metadata_Search_API.yml +17 -13
  47. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_report_if_there_are_no_works_returned_by_the_Datacite_Metadata_Search_API.yml +16 -12
  48. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml +16 -14
  49. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_total/with_no_works.yml +15 -11
  50. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_total/with_works.yml +16 -12
  51. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/parse_data/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml +437 -869
  52. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/push_data/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml +1240 -1662
  53. data/spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/push_data/should_work_with_DataCite_Event_Data.yml +4026 -6556
  54. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/get_data/should_allow_queries_by_DOI_of_the_Datacite_Metadata_Search_API.yml +15 -13
  55. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/get_data/should_allow_queries_by_ORCID_ID_of_the_Datacite_Metadata_Search_API.yml +15 -11
  56. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/get_data/should_report_if_there_are_no_works_returned_by_the_Datacite_Metadata_Search_API.yml +15 -11
  57. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/get_data/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml +15 -13
  58. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/get_total/with_no_works.yml +15 -13
  59. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/get_total/with_works.yml +15 -13
  60. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/push_data/should_delete_claims.yml +25 -32
  61. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/push_data/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml +1347 -1791
  62. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/queue_jobs/should_report_if_there_are_no_works_returned_by_the_Datacite_Metadata_Search_API.yml +14 -10
  63. data/spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/queue_jobs/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml +29 -25
  64. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml +73 -0
  65. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml +73 -0
  66. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml +95 -0
  67. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml +95 -0
  68. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml +187 -0
  69. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml +169 -0
  70. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml +667 -0
  71. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml +169 -0
  72. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml +49 -0
  73. data/spec/orcid_update_spec.rb +1 -1
  74. data/spec/queue_spec.rb +47 -0
  75. data/spec/spec_helper.rb +23 -1
  76. data/spec/usage_update_spec.rb +146 -0
  77. data/toccatore.gemspec +11 -5
  78. metadata +109 -26
@@ -8,29 +8,33 @@ http_interactions:
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - Maremma - https://github.com/datacite/maremma
11
+ - Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
12
12
  Accept:
13
13
  - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
14
14
  response:
15
15
  status:
16
16
  code: 200
17
- message: ''
17
+ message: OK
18
18
  headers:
19
- Access-Control-Allow-Methods:
20
- - GET, POST, OPTIONS
21
- Access-Control-Allow-Origin:
22
- - "*"
19
+ Date:
20
+ - Fri, 10 Aug 2018 17:32:55 GMT
23
21
  Content-Type:
24
22
  - application/json;charset=UTF-8
25
- Date:
26
- - Sat, 11 Mar 2017 08:27:51 GMT
27
- Server:
28
- - openresty/1.11.2.2
29
23
  Connection:
30
24
  - keep-alive
25
+ Server:
26
+ - nginx/1.10.3 (Ubuntu)
27
+ Access-Control-Allow-Origin:
28
+ - "*"
29
+ Access-Control-Allow-Methods:
30
+ - GET, POST, PUT, DELETE, OPTIONS
31
+ Access-Control-Allow-Headers:
32
+ - DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Authorization
33
+ Access-Control-Expose-Headers:
34
+ - DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,Authorization
31
35
  body:
32
- encoding: UTF-8
33
- string: '{"responseHeader":{"status":0,"QTime":1},"response":{"numFound":0,"start":0,"docs":[]}}
36
+ encoding: ASCII-8BIT
37
+ string: '{"responseHeader":{"status":0,"QTime":4},"response":{"numFound":0,"start":0,"docs":[]}}
34
38
 
35
39
  '
36
40
  http_version: