toccatore 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +7 -5
  3. data/lib/toccatore/base.rb +29 -1
  4. data/lib/toccatore/cli.rb +2 -0
  5. data/lib/toccatore/images/toccatore.png +0 -0
  6. data/lib/toccatore/version.rb +1 -1
  7. data/spec/base_spec.rb +32 -0
  8. data/spec/cli_spec.rb +7 -1
  9. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related.yml +56 -0
  10. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related_no_works.yml +56 -0
  11. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/orcid_update.yml +56 -0
  12. data/spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/orcid_update_no_works.yml +56 -0
  13. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_fail.yml +215 -406
  14. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_DOI.yml +141 -186
  15. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_related_identifier.yml +74 -47
  16. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_succeed.yml +617 -792
  17. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_succeed_with_no_works.yml +56 -3
  18. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_fail.yml +59 -6
  19. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_DOI.yml +162 -101
  20. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_ORCID_ID.yml +369 -278
  21. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed.yml +295 -230
  22. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_succeed_with_no_works.yml +56 -3
  23. data/spec/spec_helper.rb +1 -0
  24. data/toccatore.gemspec +1 -0
  25. metadata +21 -3
  26. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_delete.yml +0 -73
@@ -23,16 +23,69 @@ http_interactions:
23
23
  Content-Type:
24
24
  - application/json;charset=UTF-8
25
25
  Date:
26
- - Sat, 11 Mar 2017 11:13:05 GMT
26
+ - Wed, 29 Mar 2017 13:23:57 GMT
27
27
  Server:
28
28
  - openresty/1.11.2.2
29
29
  Connection:
30
30
  - keep-alive
31
31
  body:
32
32
  encoding: UTF-8
33
- string: '{"responseHeader":{"status":0,"QTime":0},"response":{"numFound":0,"start":0,"docs":[]}}
33
+ string: '{"responseHeader":{"status":0,"QTime":2},"response":{"numFound":0,"start":0,"docs":[]}}
34
34
 
35
35
  '
36
36
  http_version:
37
- recorded_at: Sat, 11 Mar 2017 11:13:05 GMT
37
+ recorded_at: Wed, 29 Mar 2017 13:23:57 GMT
38
+ - request:
39
+ method: post
40
+ uri: "<SLACK_WEBHOOK_URL>"
41
+ body:
42
+ encoding: US-ASCII
43
+ 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+2009-04-07+-+2009-04-08.%22%2C%22color%22%3A%22warning%22%7D%5D%7D
44
+ headers:
45
+ Accept-Encoding:
46
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
47
+ Accept:
48
+ - "*/*"
49
+ User-Agent:
50
+ - Ruby
51
+ Content-Type:
52
+ - application/x-www-form-urlencoded
53
+ response:
54
+ status:
55
+ code: 200
56
+ message: OK
57
+ headers:
58
+ Content-Type:
59
+ - text/html
60
+ Content-Length:
61
+ - '22'
62
+ Connection:
63
+ - keep-alive
64
+ Access-Control-Allow-Origin:
65
+ - "*"
66
+ Date:
67
+ - Wed, 29 Mar 2017 13:23:58 GMT
68
+ Referrer-Policy:
69
+ - no-referrer
70
+ Server:
71
+ - Apache
72
+ Strict-Transport-Security:
73
+ - max-age=31536000; includeSubDomains; preload
74
+ Vary:
75
+ - Accept-Encoding
76
+ X-Frame-Options:
77
+ - SAMEORIGIN
78
+ X-Slack-Backend:
79
+ - h
80
+ X-Cache:
81
+ - Miss from cloudfront
82
+ Via:
83
+ - 1.1 ec27b2a550cb7db6ef54f74603010b29.cloudfront.net (CloudFront)
84
+ X-Amz-Cf-Id:
85
+ - pqrj1Zb2XqfZCwOVIaGd-w-ub-SEOC8QL5JrlKPVE4YoTm60mT0bxA==
86
+ body:
87
+ encoding: ASCII-8BIT
88
+ string: ok
89
+ http_version:
90
+ recorded_at: Wed, 29 Mar 2017 13:23:58 GMT
38
91
  recorded_with: VCR 3.0.3
data/spec/spec_helper.rb CHANGED
@@ -90,4 +90,5 @@ VCR.configure do |c|
90
90
  c.filter_sensitive_data("<VOLPINO_TOKEN>") { ENV['VOLPINO_TOKEN'] }
91
91
  c.filter_sensitive_data("<EVENTDATA_TOKEN>") { ENV['EVENTDATA_TOKEN'] }
92
92
  c.filter_sensitive_data("<LAGOTTO_TOKEN>") { ENV['LAGOTTO_TOKEN'] }
93
+ c.filter_sensitive_data("<SLACK_WEBHOOK_URL>") { ENV['SLACK_WEBHOOK_URL'] }
93
94
  end
data/toccatore.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_dependency 'namae', '~> 0.11.0'
22
22
  s.add_dependency 'gender_detector', '~> 1.0'
23
23
  s.add_dependency 'thor', '~> 0.19'
24
+ s.add_dependency 'slack-notifier', '~> 2.1'
24
25
  s.add_development_dependency 'bundler', '~> 1.0'
25
26
  s.add_development_dependency 'rspec', '~> 3.4'
26
27
  s.add_development_dependency 'rake', '~> 12.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toccatore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
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-03-14 00:00:00.000000000 Z
11
+ date: 2017-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -106,6 +106,20 @@ dependencies:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0.19'
109
+ - !ruby/object:Gem::Dependency
110
+ name: slack-notifier
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - "~>"
114
+ - !ruby/object:Gem::Version
115
+ version: '2.1'
116
+ type: :runtime
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - "~>"
121
+ - !ruby/object:Gem::Version
122
+ version: '2.1'
109
123
  - !ruby/object:Gem::Dependency
110
124
  name: bundler
111
125
  requirement: !ruby/object:Gem::Requirement
@@ -257,6 +271,7 @@ files:
257
271
  - lib/toccatore/base.rb
258
272
  - lib/toccatore/cli.rb
259
273
  - lib/toccatore/datacite_related.rb
274
+ - lib/toccatore/images/toccatore.png
260
275
  - lib/toccatore/orcid_update.rb
261
276
  - lib/toccatore/version.rb
262
277
  - spec/base_spec.rb
@@ -272,12 +287,15 @@ files:
272
287
  - spec/fixtures/orcid_update_nil.json
273
288
  - spec/fixtures/vcr_cassettes/Toccatore_Base/get_doi_ra/crossref.yml
274
289
  - spec/fixtures/vcr_cassettes/Toccatore_Base/get_doi_ra/datacite.yml
290
+ - spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related.yml
291
+ - spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/datacite_related_no_works.yml
292
+ - spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/orcid_update.yml
293
+ - spec/fixtures/vcr_cassettes/Toccatore_Base/send_notification_to_slack/orcid_update_no_works.yml
275
294
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_fail.yml
276
295
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_DOI.yml
277
296
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_query_by_related_identifier.yml
278
297
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_succeed.yml
279
298
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/datacite_related/should_succeed_with_no_works.yml
280
- - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_delete.yml
281
299
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_fail.yml
282
300
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_DOI.yml
283
301
  - spec/fixtures/vcr_cassettes/Toccatore_CLI/orcid_update/should_query_by_ORCID_ID.yml
@@ -1,73 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://search.datacite.org/api?fl=doi,resourceTypeGeneral,relatedIdentifier,nameIdentifier,minted,updated&fq=updated:%5B2013-01-01T00:00:00Z%20TO%202017-12-31T23:59:59Z%5D%20AND%20has_metadata:true%20AND%20is_active:true&q=doi:10.6084/M9.FIGSHARE.4126869.V1&rows=0&start=0&wt=json
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- User-Agent:
11
- - Maremma - https://github.com/datacite/maremma
12
- Accept:
13
- - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
14
- response:
15
- status:
16
- code: 200
17
- message: ''
18
- headers:
19
- Access-Control-Allow-Methods:
20
- - GET, POST, OPTIONS
21
- Access-Control-Allow-Origin:
22
- - "*"
23
- Content-Type:
24
- - application/json;charset=UTF-8
25
- Date:
26
- - Sat, 11 Mar 2017 12:15:48 GMT
27
- Server:
28
- - openresty/1.11.2.2
29
- Connection:
30
- - keep-alive
31
- body:
32
- encoding: UTF-8
33
- string: '{"responseHeader":{"status":0,"QTime":0},"response":{"numFound":1,"start":0,"docs":[]}}
34
-
35
- '
36
- http_version:
37
- recorded_at: Sat, 11 Mar 2017 12:15:48 GMT
38
- - request:
39
- method: get
40
- uri: https://search.datacite.org/api?fl=doi,resourceTypeGeneral,relatedIdentifier,nameIdentifier,minted,updated&fq=updated:%5B2013-01-01T00:00:00Z%20TO%202017-12-31T23:59:59Z%5D%20AND%20has_metadata:true%20AND%20is_active:true&q=doi:10.6084/M9.FIGSHARE.4126869.V1&rows=1000&start=0&wt=json
41
- body:
42
- encoding: US-ASCII
43
- string: ''
44
- headers:
45
- User-Agent:
46
- - Maremma - https://github.com/datacite/maremma
47
- Accept:
48
- - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
49
- response:
50
- status:
51
- code: 200
52
- message: ''
53
- headers:
54
- Access-Control-Allow-Methods:
55
- - GET, POST, OPTIONS
56
- Access-Control-Allow-Origin:
57
- - "*"
58
- Content-Type:
59
- - application/json;charset=UTF-8
60
- Date:
61
- - Sat, 11 Mar 2017 12:15:48 GMT
62
- Server:
63
- - openresty/1.11.2.2
64
- Connection:
65
- - keep-alive
66
- body:
67
- encoding: UTF-8
68
- string: '{"responseHeader":{"status":0,"QTime":1},"response":{"numFound":1,"start":0,"docs":[{"minted":"2016-10-28T21:43:49Z","updated":"2016-10-28T21:44:42Z","doi":"10.6084/M9.FIGSHARE.4126869.V1","resourceTypeGeneral":"Image","relatedIdentifier":["IsIdenticalTo:DOI:10.6084/m9.figshare.4126869"],"nameIdentifier":["ORCID:0000-0003-1013-1533"]}]}}
69
-
70
- '
71
- http_version:
72
- recorded_at: Sat, 11 Mar 2017 12:15:48 GMT
73
- recorded_with: VCR 3.0.3