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
metadata CHANGED
@@ -1,49 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toccatore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.4.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-04 00:00:00.000000000 Z
11
+ date: 2018-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.7
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '3.5'
22
+ version: '5'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '3.5'
29
+ version: 3.5.7
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '4.2'
34
37
  - - ">="
35
38
  - !ruby/object:Gem::Version
36
39
  version: 4.2.5
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '6'
37
43
  type: :runtime
38
44
  prerelease: false
39
45
  version_requirements: !ruby/object:Gem::Requirement
40
46
  requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '4.2'
44
47
  - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: 4.2.5
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '6'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: dotenv
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -120,6 +126,34 @@ dependencies:
120
126
  - - "~>"
121
127
  - !ruby/object:Gem::Version
122
128
  version: '2.1'
129
+ - !ruby/object:Gem::Dependency
130
+ name: aws-sdk-sqs
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ type: :runtime
137
+ prerelease: false
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ - !ruby/object:Gem::Dependency
144
+ name: factory_bot
145
+ requirement: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
123
157
  - !ruby/object:Gem::Dependency
124
158
  name: bundler
125
159
  requirement: !ruby/object:Gem::Requirement
@@ -202,20 +236,20 @@ dependencies:
202
236
  requirements:
203
237
  - - "~>"
204
238
  - !ruby/object:Gem::Version
205
- version: '1.22'
239
+ version: '3.0'
206
240
  - - ">="
207
241
  - !ruby/object:Gem::Version
208
- version: 1.22.3
242
+ version: 3.0.1
209
243
  type: :development
210
244
  prerelease: false
211
245
  version_requirements: !ruby/object:Gem::Requirement
212
246
  requirements:
213
247
  - - "~>"
214
248
  - !ruby/object:Gem::Version
215
- version: '1.22'
249
+ version: '3.0'
216
250
  - - ">="
217
251
  - !ruby/object:Gem::Version
218
- version: 1.22.3
252
+ version: 3.0.1
219
253
  - !ruby/object:Gem::Dependency
220
254
  name: codeclimate-test-reporter
221
255
  requirement: !ruby/object:Gem::Requirement
@@ -223,9 +257,6 @@ dependencies:
223
257
  - - "~>"
224
258
  - !ruby/object:Gem::Version
225
259
  version: '1.0'
226
- - - ">="
227
- - !ruby/object:Gem::Version
228
- version: 1.0.0
229
260
  type: :development
230
261
  prerelease: false
231
262
  version_requirements: !ruby/object:Gem::Requirement
@@ -233,23 +264,48 @@ dependencies:
233
264
  - - "~>"
234
265
  - !ruby/object:Gem::Version
235
266
  version: '1.0'
267
+ - !ruby/object:Gem::Dependency
268
+ name: simplecov
269
+ requirement: !ruby/object:Gem::Requirement
270
+ requirements:
236
271
  - - ">="
237
272
  - !ruby/object:Gem::Version
238
- version: 1.0.0
273
+ version: '0'
274
+ type: :development
275
+ prerelease: false
276
+ version_requirements: !ruby/object:Gem::Requirement
277
+ requirements:
278
+ - - ">="
279
+ - !ruby/object:Gem::Version
280
+ version: '0'
239
281
  - !ruby/object:Gem::Dependency
240
- name: simplecov
282
+ name: factory_bot
241
283
  requirement: !ruby/object:Gem::Requirement
242
284
  requirements:
243
- - - "~>"
285
+ - - ">="
244
286
  - !ruby/object:Gem::Version
245
- version: 0.12.0
287
+ version: '0'
246
288
  type: :development
247
289
  prerelease: false
248
290
  version_requirements: !ruby/object:Gem::Requirement
249
291
  requirements:
250
- - - "~>"
292
+ - - ">="
293
+ - !ruby/object:Gem::Version
294
+ version: '0'
295
+ - !ruby/object:Gem::Dependency
296
+ name: faker
297
+ requirement: !ruby/object:Gem::Requirement
298
+ requirements:
299
+ - - ">="
251
300
  - !ruby/object:Gem::Version
252
- version: 0.12.0
301
+ version: '0'
302
+ type: :development
303
+ prerelease: false
304
+ version_requirements: !ruby/object:Gem::Requirement
305
+ requirements:
306
+ - - ">="
307
+ - !ruby/object:Gem::Version
308
+ version: '0'
253
309
  description: Ruby library to find ORCID IDs in the DataCite Solr index.
254
310
  email: mfenner@datacite.org
255
311
  executables:
@@ -273,18 +329,33 @@ files:
273
329
  - lib/toccatore/datacite_related.rb
274
330
  - lib/toccatore/images/toccatore.png
275
331
  - lib/toccatore/orcid_update.rb
332
+ - lib/toccatore/queue.rb
333
+ - lib/toccatore/usage_update.rb
276
334
  - lib/toccatore/version.rb
277
335
  - spec/base_spec.rb
278
336
  - spec/cli_spec.rb
279
337
  - spec/datacite_related_spec.rb
338
+ - spec/factories/default.rb
280
339
  - spec/fixtures/datacite_related.json
281
340
  - spec/fixtures/datacite_related_is_identical.json
282
341
  - spec/fixtures/datacite_related_nil.json
342
+ - spec/fixtures/event_data_resp_1
343
+ - spec/fixtures/event_data_resp_2
344
+ - spec/fixtures/events_empty.json
283
345
  - spec/fixtures/orcid_update.json
284
346
  - spec/fixtures/orcid_update_is_identical.json
285
347
  - spec/fixtures/orcid_update_is_part.json
286
348
  - spec/fixtures/orcid_update_is_previous.json
287
349
  - spec/fixtures/orcid_update_nil.json
350
+ - spec/fixtures/usage_event.json
351
+ - spec/fixtures/usage_event_fail.json
352
+ - spec/fixtures/usage_events.json
353
+ - spec/fixtures/usage_update.json
354
+ - spec/fixtures/usage_update_1.json
355
+ - spec/fixtures/usage_update_2.json
356
+ - spec/fixtures/usage_update_3.json
357
+ - spec/fixtures/usage_update_4.json
358
+ - spec/fixtures/usage_update_nil.json
288
359
  - spec/fixtures/vcr_cassettes/Toccatore_Base/get_doi_ra/crossref.yml
289
360
  - spec/fixtures/vcr_cassettes/Toccatore_Base/get_doi_ra/datacite.yml
290
361
  - spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related.yml
@@ -301,6 +372,7 @@ files:
301
372
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_ORCID_ID.yml
302
373
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed.yml
303
374
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed_with_no_works.yml
375
+ - spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml
304
376
  - spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_allow_queries_by_DOI_of_the_Datacite_Metadata_Search_API.yml
305
377
  - spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_allow_queries_by_related_identifier_of_the_Datacite_Metadata_Search_API.yml
306
378
  - spec/fixtures/vcr_cassettes/Toccatore_DataciteRelated/get_data/should_report_if_there_are_no_works_returned_by_the_Datacite_Metadata_Search_API.yml
@@ -320,8 +392,19 @@ files:
320
392
  - spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/push_data/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml
321
393
  - spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/queue_jobs/should_report_if_there_are_no_works_returned_by_the_Datacite_Metadata_Search_API.yml
322
394
  - spec/fixtures/vcr_cassettes/Toccatore_OrcidUpdate/queue_jobs/should_report_if_there_are_works_returned_by_the_Datacite_Metadata_Search_API.yml
395
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml
396
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml
397
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_no_meessage_when_the_queue_is_empty.yml
398
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_message/should_return_one_message_when_there_are_multiple_messages.yml
399
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_total/when_is_working_with_AWS.yml
400
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml
401
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml
402
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml
403
+ - spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/queue_url/should_return_always_correct_queue_url.yml
323
404
  - spec/orcid_update_spec.rb
405
+ - spec/queue_spec.rb
324
406
  - spec/spec_helper.rb
407
+ - spec/usage_update_spec.rb
325
408
  - toccatore.gemspec
326
409
  homepage: https://github.com/datacite/toccatore
327
410
  licenses:
@@ -343,7 +426,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
343
426
  version: '0'
344
427
  requirements: []
345
428
  rubyforge_project:
346
- rubygems_version: 2.4.5
429
+ rubygems_version: 2.7.7
347
430
  signing_key:
348
431
  specification_version: 4
349
432
  summary: Ruby library to find ORCID IDs in the DataCite Solr index