toccatore 0.3.9 → 0.4.0

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 (32) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile.lock +31 -18
  3. data/README.md +1 -1
  4. data/lib/toccatore.rb +2 -0
  5. data/lib/toccatore/cli.rb +12 -0
  6. data/lib/toccatore/queue.rb +50 -0
  7. data/lib/toccatore/usage_update.rb +170 -0
  8. data/lib/toccatore/version.rb +1 -1
  9. data/spec/cli_spec.rb +34 -1
  10. data/spec/fixtures/event_data_resp_1 +2 -0
  11. data/spec/fixtures/event_data_resp_2 +4 -0
  12. data/spec/fixtures/usage_event.json +1 -0
  13. data/spec/fixtures/usage_event_fail.json +17 -0
  14. data/spec/fixtures/usage_events.json +63 -0
  15. data/spec/fixtures/usage_update.json +101 -0
  16. data/spec/fixtures/usage_update_1.json +36738 -0
  17. data/spec/fixtures/usage_update_2.json +171 -0
  18. data/spec/fixtures/usage_update_3.json +176 -0
  19. data/spec/fixtures/usage_update_4.json +101 -0
  20. data/spec/fixtures/usage_update_nil.json +6 -0
  21. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/no_reports_in_the_queue/should_succeed_with_no_works.yml +150 -0
  22. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_fail.yml +150 -0
  23. data/spec/fixtures/vcr_cassettes/Toccatore_CLI/usage_update/should_succeed_with_no_works.yml +150 -0
  24. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_are_messages/should_return_the_data_for_one_message.yml +52 -0
  25. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/get_data/when_there_is_ONE_message/should_return_the_data_for_one_message.yml +52 -0
  26. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_fail_if_format_of_the_event_is_wrong.yml +199 -0
  27. data/spec/fixtures/vcr_cassettes/Toccatore_UsageUpdate/push_data/should_work_with_DataCite_Event_Data.yml +199 -0
  28. data/spec/queque_spec.rb +61 -0
  29. data/spec/spec_helper.rb +14 -0
  30. data/spec/usage_update_spec.rb +156 -0
  31. data/toccatore.gemspec +3 -1
  32. metadata +43 -7
@@ -0,0 +1,171 @@
1
+ {
2
+ "data":{
3
+ "report": {
4
+ "id": "2018-3-Dash",
5
+ "report-header": {
6
+ "report-name": "dataset report",
7
+ "report-id": "DSR",
8
+ "release": "rd1",
9
+ "created": "2128-04-09",
10
+ "created-by": "dash",
11
+ "report-attributes": [],
12
+ "report-filters": [
13
+ {
14
+ "name": "begin-date",
15
+ "value": "2018-03-01"
16
+ },
17
+ {
18
+ "name": "end-date",
19
+ "value": "2018-03-31"
20
+ }
21
+ ],
22
+ "exceptions": [
23
+ {
24
+ "code": 3040,
25
+ "severity": "warning",
26
+ "message": "partial data returned",
27
+ "help-url": "string",
28
+ "data": "usage data has not been processed for the entire reporting period"
29
+ }
30
+ ]
31
+ },
32
+ "report-datasets": [
33
+ {
34
+ "dataset-title": "chemical shift-based methods in nmr structure determination",
35
+ "dataset-id": [
36
+ {
37
+ "type": "doi",
38
+ "value": "10.7291/d1q94r"
39
+ }
40
+ ],
41
+ "dataset-contributors": [
42
+ {
43
+ "type": "name",
44
+ "value": "santrupti nerli"
45
+ },
46
+ {
47
+ "type": "name",
48
+ "value": "andrew c. mcshan"
49
+ },
50
+ {
51
+ "type": "name",
52
+ "value": "nikolaos g. sgourakis"
53
+ }
54
+ ],
55
+ "dataset-dates": [
56
+ {
57
+ "type": "pub-date",
58
+ "value": "2018-05-01"
59
+ }
60
+ ],
61
+ "platform": "dash",
62
+ "publisher": "uc santa cruz",
63
+ "publisher-id": [
64
+ {
65
+ "type": "orcid",
66
+ "value": "2059-4343-4343-4343"
67
+ }
68
+ ],
69
+ "data-type": "dataset",
70
+ "yop": "2018",
71
+ "uri": "https://dash.library.ucsc.edu/stash/dataset/doi:10.7291/d1q94r",
72
+ "performance": [
73
+ {
74
+ "period": {
75
+ "begin-date": "2018-03-01",
76
+ "end-date": "2018-03-31"
77
+ },
78
+ "instance": [
79
+ {
80
+ "access-method": "regular",
81
+ "metric-type": "total-dataset-investigations",
82
+ "count": 3
83
+ },
84
+ {
85
+ "access-method": "regular",
86
+ "metric-type": "unique-dataset-investigations",
87
+ "count": 3
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ "uri": "https://dash.ucmerced.edu/stash/dataset/doi:10.6071/Z7WC73",
95
+ "yop": 2013,
96
+ "platform": "Dash",
97
+ "data-type": "Dataset",
98
+ "publisher": "UC Merced",
99
+ "dataset-id": [
100
+ {
101
+ "type": "DOI",
102
+ "value": "10.6071/Z7WC73"
103
+ }
104
+ ],
105
+ "performance": [
106
+ {
107
+ "period": {
108
+ "end-date": "2018-03-31",
109
+ "begin-date": "2018-03-01"
110
+ },
111
+ "instance": [
112
+ {
113
+ "count": 254,
114
+ "metric-type": "Total-Dataset-Requests",
115
+ "access-method": "Machine"
116
+ },
117
+ {
118
+ "count": 208,
119
+ "metric-type": "Unique-Dataset-Requests",
120
+ "access-method": "Machine"
121
+ }
122
+ ]
123
+ }
124
+ ],
125
+ "publisher-id": [
126
+ {
127
+ "type": "GRID",
128
+ "value": "266096.d"
129
+ }
130
+ ],
131
+ "dataset-dates": [
132
+ {
133
+ "type": "Pub-Date",
134
+ "value": "2016-03-14"
135
+ }
136
+ ],
137
+ "dataset-title": "Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature",
138
+ "dataset-contributors": [
139
+ {
140
+ "type": "Name",
141
+ "value": "Roger Bales"
142
+ },
143
+ {
144
+ "type": "Name",
145
+ "value": "Matt Meadows"
146
+ },
147
+ {
148
+ "type": "Name",
149
+ "value": "Erin Stacy"
150
+ },
151
+ {
152
+ "type": "Name",
153
+ "value": "Martha Conklin"
154
+ },
155
+ {
156
+ "type": "Name",
157
+ "value": "Xiande Meng"
158
+ },
159
+ {
160
+ "type": "Name",
161
+ "value": "SSCZO Southern Sierra Critical Zone Observatory"
162
+ }
163
+ ]
164
+ }]
165
+
166
+ }
167
+ }
168
+ }
169
+
170
+
171
+
@@ -0,0 +1,176 @@
1
+ {
2
+ "data":{
3
+ "report": {
4
+ "id": "2018-3-Dash",
5
+ "report-header": {
6
+ "report-name": "dataset report",
7
+ "report-id": "DSR",
8
+ "release": "rd1",
9
+ "created": "2128-04-09",
10
+ "created-by": "dash",
11
+ "report-attributes": [],
12
+ "report-filters": [
13
+ {
14
+ "name": "begin-date",
15
+ "value": "2018-03-01"
16
+ },
17
+ {
18
+ "name": "end-date",
19
+ "value": "2018-03-31"
20
+ }
21
+ ],
22
+ "exceptions": [
23
+ {
24
+ "code": 3040,
25
+ "severity": "warning",
26
+ "message": "partial data returned",
27
+ "help-url": "string",
28
+ "data": "usage data has not been processed for the entire reporting period"
29
+ }
30
+ ]
31
+ },
32
+ "report-datasets": [
33
+ {
34
+ "dataset-title": "chemical shift-based methods in nmr structure determination",
35
+ "dataset-id": [
36
+ {
37
+ "type": "doi",
38
+ "value": "10.7291/d1q94r"
39
+ }
40
+ ],
41
+ "dataset-contributors": [
42
+ {
43
+ "type": "name",
44
+ "value": "santrupti nerli"
45
+ },
46
+ {
47
+ "type": "name",
48
+ "value": "andrew c. mcshan"
49
+ },
50
+ {
51
+ "type": "name",
52
+ "value": "nikolaos g. sgourakis"
53
+ }
54
+ ],
55
+ "dataset-dates": [
56
+ {
57
+ "type": "pub-date",
58
+ "value": "2018-05-01"
59
+ }
60
+ ],
61
+ "platform": "dash",
62
+ "publisher": "uc santa cruz",
63
+ "publisher-id": [
64
+ {
65
+ "type": "orcid",
66
+ "value": "2059-4343-4343-4343"
67
+ }
68
+ ],
69
+ "data-type": "dataset",
70
+ "yop": "2018",
71
+ "uri": "https://dash.library.ucsc.edu/stash/dataset/doi:10.7291/d1q94r",
72
+ "performance": [
73
+ {
74
+ "period": {
75
+ "begin-date": "2018-03-01",
76
+ "end-date": "2018-03-31"
77
+ },
78
+ "instance": [
79
+ {
80
+ "access-method": "regular",
81
+ "metric-type": "total-dataset-investigations",
82
+ "count": 3
83
+ },
84
+ {
85
+ "access-method": "regular",
86
+ "metric-type": "unique-dataset-investigations",
87
+ "count": 3
88
+ }
89
+ ]
90
+ }
91
+ ]
92
+ },
93
+ {
94
+ "uri": "https://dash.ucmerced.edu/stash/dataset/doi:10.6071/Z7WC73",
95
+ "yop": 2013,
96
+ "platform": "Dash",
97
+ "data-type": "Dataset",
98
+ "publisher": "UC Merced",
99
+ "dataset-id": [
100
+ {
101
+ "type": "DOI",
102
+ "value": "10.6071/Z7WC73"
103
+ }
104
+ ],
105
+ "performance": [
106
+ {
107
+ "period": {
108
+ "end-date": "2018-03-31",
109
+ "begin-date": "2018-03-01"
110
+ },
111
+ "instance": [
112
+ {
113
+ "count": 254,
114
+ "metric-type": "Total-Dataset-Requests",
115
+ "access-method": "Machine"
116
+ },
117
+ {
118
+ "count": 1,
119
+ "metric-type": "Total-Dataset-investigations",
120
+ "access-method": "Regular"
121
+ },
122
+ {
123
+ "count": 208,
124
+ "metric-type": "Unique-Dataset-Requests",
125
+ "access-method": "Machine"
126
+ }
127
+ ]
128
+ }
129
+ ],
130
+ "publisher-id": [
131
+ {
132
+ "type": "GRID",
133
+ "value": "266096.d"
134
+ }
135
+ ],
136
+ "dataset-dates": [
137
+ {
138
+ "type": "Pub-Date",
139
+ "value": "2016-03-14"
140
+ }
141
+ ],
142
+ "dataset-title": "Southern Sierra Critical Zone Observatory (SSCZO), Providence Creek meteorological data, soil moisture and temperature, snow depth and air temperature",
143
+ "dataset-contributors": [
144
+ {
145
+ "type": "Name",
146
+ "value": "Roger Bales"
147
+ },
148
+ {
149
+ "type": "Name",
150
+ "value": "Matt Meadows"
151
+ },
152
+ {
153
+ "type": "Name",
154
+ "value": "Erin Stacy"
155
+ },
156
+ {
157
+ "type": "Name",
158
+ "value": "Martha Conklin"
159
+ },
160
+ {
161
+ "type": "Name",
162
+ "value": "Xiande Meng"
163
+ },
164
+ {
165
+ "type": "Name",
166
+ "value": "SSCZO Southern Sierra Critical Zone Observatory"
167
+ }
168
+ ]
169
+ }]
170
+
171
+ }
172
+ }
173
+ }
174
+
175
+
176
+
@@ -0,0 +1,101 @@
1
+ {
2
+ "data":{
3
+ "report": {
4
+ "id": "2018-3-Dash",
5
+ "report-header": {
6
+ "report-name": "dataset report",
7
+ "report-id": "DSR",
8
+ "release": "rd1",
9
+ "created": "2128-04-09",
10
+ "created-by": "dash",
11
+ "report-attributes": [],
12
+ "report-filters": [
13
+ {
14
+ "name": "begin-date",
15
+ "value": "2018-03-01"
16
+ },
17
+ {
18
+ "name": "end-date",
19
+ "value": "2018-03-31"
20
+ }
21
+ ],
22
+ "exceptions": [
23
+ {
24
+ "code": 3040,
25
+ "severity": "warning",
26
+ "message": "partial data returned",
27
+ "help-url": "string",
28
+ "data": "usage data has not been processed for the entire reporting period"
29
+ }
30
+ ]
31
+ },
32
+ "report-datasets": [
33
+ {
34
+ "dataset-title": "chemical shift-based methods in nmr structure determination",
35
+ "dataset-id": [
36
+ {
37
+ "type": "doi",
38
+ "value": "10.7291/d1q94r"
39
+ }
40
+ ],
41
+ "dataset-contributors": [
42
+ {
43
+ "type": "name",
44
+ "value": "santrupti nerli"
45
+ },
46
+ {
47
+ "type": "name",
48
+ "value": "andrew c. mcshan"
49
+ },
50
+ {
51
+ "type": "name",
52
+ "value": "nikolaos g. sgourakis"
53
+ }
54
+ ],
55
+ "dataset-dates": [
56
+ {
57
+ "type": "pub-date",
58
+ "value": "2018-05-01"
59
+ }
60
+ ],
61
+ "platform": "dash",
62
+ "publisher": "uc santa cruz",
63
+ "publisher-id": [
64
+ {
65
+ "type": "orcid",
66
+ "value": "2059-4343-4343-4343"
67
+ }
68
+ ],
69
+ "data-type": "dataset",
70
+ "yop": "2018",
71
+ "uri": "https://dash.library.ucsc.edu/stash/dataset/doi:10.7291/d1q94r",
72
+ "performance": [
73
+ {
74
+ "period": {
75
+ "begin-date": "2018-03-01",
76
+ "end-date": "2018-03-31"
77
+ },
78
+ "instance": [
79
+ {
80
+ "country": "gb",
81
+ "access-method": "regular",
82
+ "metric-type": "total-dataset-investigations",
83
+ "count": 3
84
+ },
85
+ {
86
+ "country": "gb",
87
+ "access-method": "regular",
88
+ "metric-type": "unique-dataset-investigations",
89
+ "count": 3
90
+ }
91
+ ]
92
+ }
93
+ ]
94
+ }]
95
+
96
+ }
97
+ }
98
+ }
99
+
100
+
101
+