toccatore 0.4.12 → 0.4.13
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/toccatore/base.rb +7 -1
- data/lib/toccatore/datacite_related.rb +7 -1
- data/lib/toccatore/orcid_update.rb +6 -2
- data/lib/toccatore/usage_update.rb +4 -3
- data/lib/toccatore/version.rb +1 -1
- data/spec/cli_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2e7bd1c2f2e2c09c0fe6adcab866b0dbb20b2b80904f961c19b47a2c1fb5d7c
|
4
|
+
data.tar.gz: ba2940625807aa1010be4a1e420338cfee27e303d9ed07647753931709d25829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 692694881c5c8d48542ce05abd38397b1dc656535851646e722e2bb42d3e95f512c3d62a3c6ab6894e55e9b8cfff93916c7fb8ab2aa42f6b308a8ab7cec2bdea
|
7
|
+
data.tar.gz: 16faa9f7e9015f81203b8c738ef584933778fc569e3d29d9d74cf455810cf249e1b9a54606c6b73a9ebfae38ef44899412c748318cef4e674821f60a34e55f0a
|
data/Gemfile.lock
CHANGED
data/lib/toccatore/base.rb
CHANGED
@@ -82,7 +82,13 @@ module Toccatore
|
|
82
82
|
puts text
|
83
83
|
|
84
84
|
# send slack notification
|
85
|
-
|
85
|
+
if total == 0
|
86
|
+
options[:level] = "warning"
|
87
|
+
elsif error_total > 0
|
88
|
+
options[:level] = "danger"
|
89
|
+
else
|
90
|
+
options[:level] = "good"
|
91
|
+
end
|
86
92
|
options[:title] = "Report for #{source_id}"
|
87
93
|
send_notification_to_slack(text, options) if options[:slack_webhook_url].present?
|
88
94
|
|
@@ -58,7 +58,10 @@ module Toccatore
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def push_item(item, options={})
|
61
|
-
|
61
|
+
if options[:access_token].blank?
|
62
|
+
puts "Access token missing."
|
63
|
+
return 1
|
64
|
+
end
|
62
65
|
|
63
66
|
host = options[:push_url].presence || "https://bus.eventdata.crossref.org"
|
64
67
|
push_url = host + "/events"
|
@@ -92,6 +95,9 @@ module Toccatore
|
|
92
95
|
if response.status == 201
|
93
96
|
puts "#{item['subj_id']} #{item['relation_type_id']} #{item['obj_id']} pushed to Event Data service."
|
94
97
|
0
|
98
|
+
elsif response.status == 409
|
99
|
+
puts "#{item['subj_id']} #{item['relation_type_id']} #{item['obj_id']} already pushed to Event Data service."
|
100
|
+
0
|
95
101
|
elsif response.body["errors"].present?
|
96
102
|
puts "#{item['subj_id']} #{item['relation_type_id']} #{item['obj_id']} had an error:"
|
97
103
|
puts "#{response.body['errors'].first['title']}"
|
@@ -44,9 +44,13 @@ module Toccatore
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def push_item(item, options={})
|
47
|
-
|
47
|
+
if options[:access_token].blank?
|
48
|
+
puts "Access token missing."
|
49
|
+
return 1
|
50
|
+
end
|
48
51
|
|
49
|
-
|
52
|
+
host = options[:push_url].presence || "https://profiles.datacite.org/api"
|
53
|
+
push_url = host + "/claims"
|
50
54
|
|
51
55
|
response = Maremma.post(push_url, data: { "claim" => item }.to_json,
|
52
56
|
bearer: options[:access_token],
|
@@ -161,10 +161,11 @@ module Toccatore
|
|
161
161
|
"id" => item["uuid"],
|
162
162
|
"type" => "events",
|
163
163
|
"attributes" => item.except("id") }}
|
164
|
+
|
164
165
|
response = Maremma.put(push_url, data: data.to_json,
|
165
|
-
|
166
|
-
|
167
|
-
|
166
|
+
bearer: options[:access_token],
|
167
|
+
content_type: 'json',
|
168
|
+
host: host)
|
168
169
|
|
169
170
|
if response.status == 201
|
170
171
|
puts "#{item['subj-id']} #{item['relation-type-id']} #{item['obj-id']} pushed to Event Data service."
|
data/lib/toccatore/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED