toccatore 0.4.11 → 0.4.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/toccatore/datacite_related.rb +1 -1
- data/lib/toccatore/usage_update.rb +1 -1
- data/lib/toccatore/version.rb +1 -1
- data/spec/cli_spec.rb +1 -1
- data/spec/factories/default.rb +1 -1
- data/spec/fixtures/events_empty.json +2 -2
- data/spec/fixtures/usage_event_fail.json +1 -1
- data/spec/fixtures/usage_events.json +4 -4
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_empty.yml +1 -1
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml +4 -4
- data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml +1 -1
- data/spec/usage_update_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78861df5575f3504d5cce258bc6bfd59751da8269a4b57f47f11d1bb4836930e
|
4
|
+
data.tar.gz: 57293cd4eae644a522a925046e61cd90b397621a32dc85d0dc050821bc4613e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4860c8001b3e4a383cb537072e1e83ebfb9789894f16b2cbe2d7ceefcb52b617e35dd3abd103366a3b10039cb4a9b3701b5628a42cedb8520946d2cbbb965e7
|
7
|
+
data.tar.gz: 54a4c8fc3962e6d7c04889ad481bbc38344b5a5c9c38577142825cd4ae4bbf9a85c615639e6078dc79e1e9ed1a615718be5e4a0205ccfde479ffd5d8299aed9a
|
data/Gemfile.lock
CHANGED
@@ -74,7 +74,7 @@ module Toccatore
|
|
74
74
|
"relation-type-id" => item["relation_type_id"],
|
75
75
|
"source-id" => "datacite-crossref",
|
76
76
|
"source-token" => item["source_token"],
|
77
|
-
"occurred-at" => item["
|
77
|
+
"occurred-at" => item["occurred_at"],
|
78
78
|
"license" => item["license"] } }}
|
79
79
|
|
80
80
|
response = Maremma.post(push_url, data: data.to_json,
|
data/lib/toccatore/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
data/spec/factories/default.rb
CHANGED
@@ -5,7 +5,7 @@ require 'securerandom'
|
|
5
5
|
FactoryBot.define do
|
6
6
|
factory :event , class: OpenStruct do
|
7
7
|
sequence(:uuid) { |n| "#{SecureRandom.uuid}-#{n}" }
|
8
|
-
message_action "
|
8
|
+
message_action "create"
|
9
9
|
sequence(:obj_id) { |n| "#{Faker::Internet.url}#{n}" }
|
10
10
|
sequence(:subj_id) { |n| "#{Faker::Internet.url}#{n}" }
|
11
11
|
total Faker::Number.number(3)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[
|
2
2
|
{
|
3
3
|
"uuid": "",
|
4
|
-
"message-action": "
|
4
|
+
"message-action": "create",
|
5
5
|
"subj-id": "",
|
6
6
|
"subj": {
|
7
7
|
"pid": "",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"license": ""
|
17
17
|
}, {
|
18
18
|
"uuid": "fc6860b8-4230-41bc-8b8e-21d60e9a7d9a",
|
19
|
-
"message-action": "
|
19
|
+
"message-action": "create",
|
20
20
|
"subj-id": "https://api.test.datacite.org/reports/2018-3-Dashs",
|
21
21
|
"subj": {
|
22
22
|
"pid": "https://api.test.datacite.org/reports/2018-3-Dashs",
|
@@ -1,7 +1,7 @@
|
|
1
1
|
[
|
2
2
|
{
|
3
3
|
"uuid": "a17e783b-8214-451e-9b0d-077213c2acae",
|
4
|
-
"message-action": "
|
4
|
+
"message-action": "create",
|
5
5
|
"subj-id": "https://api.test.datacite.org/reports/2018-3-Dash",
|
6
6
|
"subj": {
|
7
7
|
"pid": "https://api.test.datacite.org/reports/2018-3-Dash",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"license": "https://creativecommons.org/publicdomain/zero/1.0/"
|
17
17
|
}, {
|
18
18
|
"uuid": "fc6860b8-4230-41bc-8b8e-21d60e9a7d9a",
|
19
|
-
"message-action": "
|
19
|
+
"message-action": "create",
|
20
20
|
"subj-id": "https://api.test.datacite.org/reports/2018-3-Dash",
|
21
21
|
"subj": {
|
22
22
|
"pid": "https://api.test.datacite.org/reports/2018-3-Dash",
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"license": "https://creativecommons.org/publicdomain/zero/1.0/"
|
32
32
|
}, {
|
33
33
|
"uuid": "054da0ad-9821-492e-877e-5c3adbfd5ccf",
|
34
|
-
"message-action": "
|
34
|
+
"message-action": "create",
|
35
35
|
"subj-id": "https://api.test.datacite.org/reports/2018-3-Dash",
|
36
36
|
"subj": {
|
37
37
|
"pid": "https://api.test.datacite.org/reports/2018-3-Dash",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"license": "https://creativecommons.org/publicdomain/zero/1.0/"
|
47
47
|
}, {
|
48
48
|
"uuid": "6d6fd620-2123-42da-91f3-6c02e63f3cec",
|
49
|
-
"message-action": "
|
49
|
+
"message-action": "create",
|
50
50
|
"subj-id": "https://api.test.datacite.org/reports/2018-3-Dash",
|
51
51
|
"subj": {
|
52
52
|
"pid": "https://api.test.datacite.org/reports/2018-3-Dash",
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.test.datacite.org/events/fc6860b8-4230-41bc-8b8e-21d60e9a7d9a
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"data":{"id":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","type":"events","attributes":{"uuid":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","message-action":"
|
8
|
+
string: '{"data":{"id":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","type":"events","attributes":{"uuid":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","message-action":"create","subj-id":"https://api.test.datacite.org/reports/2018-3-Dashs","subj":{"pid":"https://api.test.datacite.org/reports/2018-3-Dashs","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"unique-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.test.datacite.org/events/a17e783b-8214-451e-9b0d-077213c2acae
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"data":{"id":"a17e783b-8214-451e-9b0d-077213c2acae","type":"events","attributes":{"uuid":"a17e783b-8214-451e-9b0d-077213c2acae","message-action":"
|
8
|
+
string: '{"data":{"id":"a17e783b-8214-451e-9b0d-077213c2acae","type":"events","attributes":{"uuid":"a17e783b-8214-451e-9b0d-077213c2acae","message-action":"create","subj-id":"https://api.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://api.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"total-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
|
@@ -171,7 +171,7 @@ http_interactions:
|
|
171
171
|
uri: https://api.test.datacite.org/events/fc6860b8-4230-41bc-8b8e-21d60e9a7d9a
|
172
172
|
body:
|
173
173
|
encoding: UTF-8
|
174
|
-
string: '{"data":{"id":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","type":"events","attributes":{"uuid":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","message-action":"
|
174
|
+
string: '{"data":{"id":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","type":"events","attributes":{"uuid":"fc6860b8-4230-41bc-8b8e-21d60e9a7d9a","message-action":"create","subj-id":"https://api.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://api.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"unique-dataset-investigations-regular","source-id":"datacite-usage","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
|
175
175
|
headers:
|
176
176
|
User-Agent:
|
177
177
|
- Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
|
@@ -337,7 +337,7 @@ http_interactions:
|
|
337
337
|
uri: https://api.test.datacite.org/events/054da0ad-9821-492e-877e-5c3adbfd5ccf
|
338
338
|
body:
|
339
339
|
encoding: UTF-8
|
340
|
-
string: '{"data":{"id":"054da0ad-9821-492e-877e-5c3adbfd5ccf","type":"events","attributes":{"uuid":"054da0ad-9821-492e-877e-5c3adbfd5ccf","message-action":"
|
340
|
+
string: '{"data":{"id":"054da0ad-9821-492e-877e-5c3adbfd5ccf","type":"events","attributes":{"uuid":"054da0ad-9821-492e-877e-5c3adbfd5ccf","message-action":"create","subj-id":"https://api.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://api.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":254,"obj-id":"https://doi.org/10.6071/z7wc73","relation-type-id":"Total-Dataset-Requests-Machine","source-id":"datacite-usage","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
|
341
341
|
headers:
|
342
342
|
User-Agent:
|
343
343
|
- Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
|
@@ -503,7 +503,7 @@ http_interactions:
|
|
503
503
|
uri: https://api.test.datacite.org/events/6d6fd620-2123-42da-91f3-6c02e63f3cec
|
504
504
|
body:
|
505
505
|
encoding: UTF-8
|
506
|
-
string: '{"data":{"id":"6d6fd620-2123-42da-91f3-6c02e63f3cec","type":"events","attributes":{"uuid":"6d6fd620-2123-42da-91f3-6c02e63f3cec","message-action":"
|
506
|
+
string: '{"data":{"id":"6d6fd620-2123-42da-91f3-6c02e63f3cec","type":"events","attributes":{"uuid":"6d6fd620-2123-42da-91f3-6c02e63f3cec","message-action":"create","subj-id":"https://api.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://api.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":208,"obj-id":"https://doi.org/10.6071/z7wc73","relation-type-id":"Unique-Dataset-Requests-Machine","source-id":"datacite-usage","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
|
507
507
|
headers:
|
508
508
|
User-Agent:
|
509
509
|
- Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
|
data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_a_single_item.yml
CHANGED
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.test.datacite.org/events/a17e783b-8214-451e-9b0d-077213c2acae
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"data":{"id":"a17e783b-8214-451e-9b0d-077213c2acae","type":"events","attributes":{"uuid":"a17e783b-8214-451e-9b0d-077213c2acae","message-action":"
|
8
|
+
string: '{"data":{"id":"a17e783b-8214-451e-9b0d-077213c2acae","type":"events","attributes":{"uuid":"a17e783b-8214-451e-9b0d-077213c2acae","message-action":"create","subj-id":"https://api.test.datacite.org/reports/2018-3-Dash","subj":{"pid":"https://api.test.datacite.org/reports/2018-3-Dash","issued":"2128-04-09"},"total":3,"obj-id":"https://doi.org/10.7291/d1q94r","relation-type-id":"total-dataset-investigations-regular","source-id":"datacite","source-token":"28276d12-b320-41ba-9272-bb0adc3466ff","occurred-at":"2128-04-09","license":"https://creativecommons.org/publicdomain/zero/1.0/"}}}'
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
11
|
- Mozilla/5.0 (compatible; Maremma/4.1; +https://github.com/datacite/maremma)
|
data/spec/usage_update_spec.rb
CHANGED
@@ -76,7 +76,7 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
76
76
|
result = OpenStruct.new(body: JSON.parse(body), url:"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" )
|
77
77
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
78
78
|
expect(response.length).to eq(2)
|
79
|
-
expect(response.last.except("uuid")).to eq("subj"=>{"pid"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"},"total"=>3,"message-action" => "
|
79
|
+
expect(response.last.except("uuid")).to eq("subj"=>{"pid"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"},"total"=>3,"message-action" => "create", "subj-id"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "obj-id"=>"https://doi.org/10.7291/d1q94r", "relation-type-id"=>"unique-dataset-investigations-regular", "source-id"=>"datacite-usage", "occurred-at"=>"2128-04-09", "license" => "https://creativecommons.org/publicdomain/zero/1.0/", "source-token" => ENV['SOURCE_TOKEN'])
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should parsed it correctly when it has five metrics and two DOIs" do
|
@@ -84,7 +84,7 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
84
84
|
result = OpenStruct.new(body: JSON.parse(body), url:"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad" )
|
85
85
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
86
86
|
expect(response.length).to eq(5)
|
87
|
-
expect(response.last.except("uuid")).to eq("message-action"=>"
|
87
|
+
expect(response.last.except("uuid")).to eq("message-action"=>"create", "subj-id"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "subj"=>{"pid"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"}, "total"=>208, "obj-id"=>"https://doi.org/10.6071/z7wc73", "relation-type-id"=>"Unique-Dataset-Requests-Machine", "source-id"=>"datacite-usage", "source-token"=>ENV['SOURCE_TOKEN'], "occurred-at"=>"2128-04-09", "license"=>"https://creativecommons.org/publicdomain/zero/1.0/")
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should parsed it correctly when it has two metrics per DOI " do
|
@@ -92,7 +92,7 @@ describe Toccatore::UsageUpdate, vcr: true do
|
|
92
92
|
result = OpenStruct.new(body: JSON.parse(body), url:"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad")
|
93
93
|
response = subject.parse_data(result, source_token: ENV['SOURCE_TOKEN'])
|
94
94
|
expect(response.length).to eq(4)
|
95
|
-
expect(response.last.except("uuid")).to eq("message-action"=>"
|
95
|
+
expect(response.last.except("uuid")).to eq("message-action"=>"create", "subj-id"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "subj"=>{"pid"=>"https://api.test.datacite.org/reports/5cac6ca0-9391-4e1d-95cf-ba2f475cbfad", "issued"=>"2128-04-09"}, "total"=>208, "obj-id"=>"https://doi.org/10.6071/z7wc73", "relation-type-id"=>"Unique-Dataset-Requests-Machine", "source-id"=>"datacite-usage", "source-token"=>ENV['SOURCE_TOKEN'], "occurred-at"=>"2128-04-09", "license"=>"https://creativecommons.org/publicdomain/zero/1.0/")
|
96
96
|
end
|
97
97
|
|
98
98
|
it "should send a warning if there are more than 4 metrics" do
|
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.4.
|
4
|
+
version: 0.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: maremma
|