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
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: "<SLACK_WEBHOOK_URL>"
6
6
  body:
7
7
  encoding: US-ASCII
8
- 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+datacite_related%22%2C%22text%22%3A%220+works+found+for+date+range+2015-04-07+-+2015-04-08.%22%2C%22color%22%3A%22warning%22%7D%5D%7D
8
+ 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+datacite_related%22%2C%22text%22%3A%22No+works+found+for+date+range+2015-04-07+-+2015-04-08.%22%2C%22color%22%3A%22warning%22%7D%5D%7D
9
9
  headers:
10
10
  Accept-Encoding:
11
11
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
@@ -26,31 +26,33 @@ http_interactions:
26
26
  - '22'
27
27
  Connection:
28
28
  - keep-alive
29
- Access-Control-Allow-Origin:
30
- - "*"
31
29
  Date:
32
- - Wed, 29 Mar 2017 12:32:14 GMT
33
- Referrer-Policy:
34
- - no-referrer
30
+ - Fri, 10 Aug 2018 16:22:55 GMT
35
31
  Server:
36
32
  - Apache
33
+ X-Slack-Backend:
34
+ - h
35
+ Referrer-Policy:
36
+ - no-referrer
37
37
  Strict-Transport-Security:
38
38
  - max-age=31536000; includeSubDomains; preload
39
- Vary:
40
- - Accept-Encoding
41
39
  X-Frame-Options:
42
40
  - SAMEORIGIN
43
- X-Slack-Backend:
44
- - h
41
+ Vary:
42
+ - Accept-Encoding
43
+ Access-Control-Allow-Origin:
44
+ - "*"
45
+ X-Via:
46
+ - haproxy-www-1dak
45
47
  X-Cache:
46
48
  - Miss from cloudfront
47
49
  Via:
48
- - 1.1 ffaf96eee86cf7d96c222b2f54e79b63.cloudfront.net (CloudFront)
50
+ - 1.1 8391f131e4acb30724947dab1f8592a5.cloudfront.net (CloudFront)
49
51
  X-Amz-Cf-Id:
50
- - sId6-A4zxQG3y6g80-ChvRT3r9j6sEDB7Xk2-YBlPktC2847t3eG2Q==
52
+ - yA55f36SX2NU10nM60AG-sukjhRiMrkcE7XYzKhWkfkspwTo9-JAHw==
51
53
  body:
52
54
  encoding: ASCII-8BIT
53
55
  string: ok
54
56
  http_version:
55
- recorded_at: Wed, 29 Mar 2017 12:32:15 GMT
57
+ recorded_at: Fri, 10 Aug 2018 16:22:55 GMT
56
58
  recorded_with: VCR 3.0.3
@@ -26,31 +26,33 @@ http_interactions:
26
26
  - '22'
27
27
  Connection:
28
28
  - keep-alive
29
- Access-Control-Allow-Origin:
30
- - "*"
31
29
  Date:
32
- - Wed, 29 Mar 2017 12:32:55 GMT
33
- Referrer-Policy:
34
- - no-referrer
30
+ - Fri, 10 Aug 2018 16:22:55 GMT
35
31
  Server:
36
32
  - Apache
33
+ X-Slack-Backend:
34
+ - h
35
+ Referrer-Policy:
36
+ - no-referrer
37
37
  Strict-Transport-Security:
38
38
  - max-age=31536000; includeSubDomains; preload
39
- Vary:
40
- - Accept-Encoding
41
39
  X-Frame-Options:
42
40
  - SAMEORIGIN
43
- X-Slack-Backend:
44
- - h
41
+ Vary:
42
+ - Accept-Encoding
43
+ Access-Control-Allow-Origin:
44
+ - "*"
45
+ X-Via:
46
+ - haproxy-www-egoz
45
47
  X-Cache:
46
48
  - Miss from cloudfront
47
49
  Via:
48
- - 1.1 9ddc180a2ed3a76b4f04630a423d2191.cloudfront.net (CloudFront)
50
+ - 1.1 5954578e851092964f39f2f5f0596950.cloudfront.net (CloudFront)
49
51
  X-Amz-Cf-Id:
50
- - m83jooakTi1cBV-qNAu3fzsAWk07G1je1icRGbFI2KiYFM34D2Np-w==
52
+ - gaF12DJ6cemBuBReC2E4UVsBD1vITQqkohD7fo8xysh7Ckx5dILaxg==
51
53
  body:
52
54
  encoding: ASCII-8BIT
53
55
  string: ok
54
56
  http_version:
55
- recorded_at: Wed, 29 Mar 2017 12:32:55 GMT
57
+ recorded_at: Fri, 10 Aug 2018 16:22:55 GMT
56
58
  recorded_with: VCR 3.0.3
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: "<SLACK_WEBHOOK_URL>"
6
6
  body:
7
7
  encoding: US-ASCII
8
- 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+orcid_update%22%2C%22text%22%3A%220+works+found+for+date+range+2015-04-07+-+2015-04-08.%22%2C%22color%22%3A%22warning%22%7D%5D%7D
8
+ 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+orcid_update%22%2C%22text%22%3A%22No+works+found+for+date+range+2015-04-07+-+2015-04-08.%22%2C%22color%22%3A%22warning%22%7D%5D%7D
9
9
  headers:
10
10
  Accept-Encoding:
11
11
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
@@ -26,31 +26,33 @@ http_interactions:
26
26
  - '22'
27
27
  Connection:
28
28
  - keep-alive
29
- Access-Control-Allow-Origin:
30
- - "*"
31
29
  Date:
32
- - Wed, 29 Mar 2017 12:32:57 GMT
33
- Referrer-Policy:
34
- - no-referrer
30
+ - Fri, 10 Aug 2018 16:22:55 GMT
35
31
  Server:
36
32
  - Apache
33
+ X-Slack-Backend:
34
+ - h
35
+ Referrer-Policy:
36
+ - no-referrer
37
37
  Strict-Transport-Security:
38
38
  - max-age=31536000; includeSubDomains; preload
39
- Vary:
40
- - Accept-Encoding
41
39
  X-Frame-Options:
42
40
  - SAMEORIGIN
43
- X-Slack-Backend:
44
- - h
41
+ Vary:
42
+ - Accept-Encoding
43
+ Access-Control-Allow-Origin:
44
+ - "*"
45
+ X-Via:
46
+ - haproxy-www-gqq9
45
47
  X-Cache:
46
48
  - Miss from cloudfront
47
49
  Via:
48
- - 1.1 116dfe20853b94f9e029d92f1353f8c8.cloudfront.net (CloudFront)
50
+ - 1.1 e72ed739d85b0c5633dfd1f214a1adca.cloudfront.net (CloudFront)
49
51
  X-Amz-Cf-Id:
50
- - eAUEy-sXUZzMpWkaWjQ5aSVrAvdRLAm-CBBLqx22pvzfLSeHgsJaog==
52
+ - vEtVeIti62chzJq_sHG7P_fHVny7c9nQNC9RckvHM3Vfr5YST6Hulg==
51
53
  body:
52
54
  encoding: ASCII-8BIT
53
55
  string: ok
54
56
  http_version:
55
- recorded_at: Wed, 29 Mar 2017 12:32:59 GMT
57
+ recorded_at: Fri, 10 Aug 2018 16:22:55 GMT
56
58
  recorded_with: VCR 3.0.3