datacite 0.8.3 → 0.8.5
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/.circleci/config.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +88 -47
- data/README.md +10 -0
- data/bin/validate-cocina +35 -0
- data/lib/datacite/mapping/from_cocina/types.rb +23 -16
- data/lib/datacite/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00f41bdc53e8f7aaa02f9f09e1dfe88edf480c12227f76fd8119b1ec261db326
|
|
4
|
+
data.tar.gz: f99aa687067a3b5ed223916e1a10b52e14c2ccce291f79369db3308646034865
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 59c3b1b903a6b0288816db41213e6c0201863b8f94acf411e8851edd9717f14c1f4f3e54dd7ddfceeec762f113ff77d203b74971bee596ad22a916162dc0c49c
|
|
7
|
+
data.tar.gz: ffa85b5ecf4d3042f98b3565ae4105ce08ef1c065fc622e5f38392cccd7e7548773344fa46d9ae4202f399ff848289420b04c79b4810ea949aa870de71d249ce
|
data/.circleci/config.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
datacite (0.8.
|
|
4
|
+
datacite (0.8.5)
|
|
5
5
|
activesupport
|
|
6
6
|
dry-monads (~> 1.3)
|
|
7
7
|
faraday (~> 2.0)
|
|
@@ -11,7 +11,7 @@ PATH
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
activesupport (8.1.3)
|
|
14
|
+
activesupport (8.1.3.1)
|
|
15
15
|
base64
|
|
16
16
|
bigdecimal
|
|
17
17
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
@@ -30,31 +30,39 @@ GEM
|
|
|
30
30
|
attr_extras (7.1.0)
|
|
31
31
|
base64 (0.3.0)
|
|
32
32
|
bigdecimal (4.1.2)
|
|
33
|
-
|
|
34
|
-
reline (>= 0.6.0)
|
|
35
|
-
cocina-models (0.116.0)
|
|
33
|
+
cocina-models (0.133.0)
|
|
36
34
|
activesupport
|
|
35
|
+
cocina_display
|
|
37
36
|
deprecation
|
|
38
37
|
dry-struct (~> 1.0)
|
|
39
38
|
dry-types (~> 1.1)
|
|
40
39
|
edtf
|
|
41
40
|
equivalent-xml
|
|
42
41
|
i18n
|
|
43
|
-
|
|
44
|
-
jsonpath
|
|
42
|
+
jsonschema_rs
|
|
45
43
|
nokogiri
|
|
46
44
|
super_diff
|
|
47
45
|
thor
|
|
48
46
|
zeitwerk (~> 2.1)
|
|
49
|
-
|
|
47
|
+
cocina_display (2.10.0)
|
|
48
|
+
activesupport (>= 7)
|
|
49
|
+
edtf (~> 3.2)
|
|
50
|
+
geo_coord (~> 0.2)
|
|
51
|
+
i18n
|
|
52
|
+
iso8601 (~> 0.13.0)
|
|
53
|
+
janeway-jsonpath (>= 0.6, < 2)
|
|
54
|
+
zeitwerk (~> 2.7)
|
|
55
|
+
concurrent-ruby (1.3.8)
|
|
50
56
|
connection_pool (3.0.2)
|
|
51
57
|
crack (1.0.1)
|
|
52
58
|
bigdecimal
|
|
53
59
|
rexml
|
|
60
|
+
debug (1.11.1)
|
|
61
|
+
irb (~> 1.10)
|
|
62
|
+
reline (>= 0.3.8)
|
|
54
63
|
deprecation (1.1.0)
|
|
55
64
|
activesupport
|
|
56
65
|
diff-lcs (1.6.2)
|
|
57
|
-
docile (1.4.1)
|
|
58
66
|
drb (2.2.3)
|
|
59
67
|
dry-core (1.2.0)
|
|
60
68
|
concurrent-ruby (~> 1.0)
|
|
@@ -82,69 +90,105 @@ GEM
|
|
|
82
90
|
dry-inflector (~> 1.0)
|
|
83
91
|
dry-logic (~> 1.4)
|
|
84
92
|
zeitwerk (~> 2.6)
|
|
85
|
-
edtf (3.
|
|
93
|
+
edtf (3.3.0)
|
|
86
94
|
activesupport (>= 3.0, < 9.0)
|
|
87
95
|
equivalent-xml (0.6.0)
|
|
88
96
|
nokogiri (>= 1.4.3)
|
|
89
|
-
|
|
97
|
+
erb (6.0.7)
|
|
98
|
+
faraday (2.14.3)
|
|
90
99
|
faraday-net_http (>= 2.0, < 3.5)
|
|
91
100
|
json
|
|
92
101
|
logger
|
|
93
|
-
faraday-net_http (3.4.
|
|
102
|
+
faraday-net_http (3.4.4)
|
|
94
103
|
net-http (~> 0.5)
|
|
104
|
+
geo_coord (0.2.0)
|
|
95
105
|
hana (1.3.7)
|
|
96
106
|
hashdiff (1.2.1)
|
|
97
|
-
i18n (1.
|
|
107
|
+
i18n (1.15.2)
|
|
98
108
|
concurrent-ruby (~> 1.0)
|
|
99
109
|
ice_nine (0.11.2)
|
|
100
|
-
io-console (0.
|
|
101
|
-
|
|
110
|
+
io-console (0.9.2)
|
|
111
|
+
irb (1.18.0)
|
|
112
|
+
pp (>= 0.6.0)
|
|
113
|
+
prism (>= 1.3.0)
|
|
114
|
+
rdoc (>= 4.0.0)
|
|
115
|
+
reline (>= 0.4.2)
|
|
116
|
+
iso8601 (0.13.0)
|
|
117
|
+
janeway-jsonpath (1.1.0)
|
|
118
|
+
json (2.21.2)
|
|
102
119
|
json_schemer (2.5.0)
|
|
103
120
|
bigdecimal
|
|
104
121
|
hana (~> 1.3)
|
|
105
122
|
regexp_parser (~> 2.0)
|
|
106
123
|
simpleidn (~> 0.2)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
124
|
+
jsonschema_rs (0.49.9)
|
|
125
|
+
bigdecimal (>= 3.1, < 5)
|
|
126
|
+
rb_sys (~> 0.9.124)
|
|
127
|
+
jsonschema_rs (0.49.9-aarch64-linux)
|
|
128
|
+
bigdecimal (>= 3.1, < 5)
|
|
129
|
+
jsonschema_rs (0.49.9-aarch64-linux-musl)
|
|
130
|
+
bigdecimal (>= 3.1, < 5)
|
|
131
|
+
jsonschema_rs (0.49.9-arm64-darwin)
|
|
132
|
+
bigdecimal (>= 3.1, < 5)
|
|
133
|
+
jsonschema_rs (0.49.9-x86_64-darwin)
|
|
134
|
+
bigdecimal (>= 3.1, < 5)
|
|
135
|
+
jsonschema_rs (0.49.9-x86_64-linux)
|
|
136
|
+
bigdecimal (>= 3.1, < 5)
|
|
137
|
+
jsonschema_rs (0.49.9-x86_64-linux-musl)
|
|
138
|
+
bigdecimal (>= 3.1, < 5)
|
|
139
|
+
language_server-protocol (3.17.0.6)
|
|
110
140
|
lint_roller (1.1.0)
|
|
111
141
|
logger (1.7.0)
|
|
112
|
-
minitest (6.0.
|
|
142
|
+
minitest (6.0.6)
|
|
113
143
|
drb (~> 2.0)
|
|
114
144
|
prism (~> 1.5)
|
|
115
|
-
multi_json (1.20.1)
|
|
116
145
|
net-http (0.9.1)
|
|
117
146
|
uri (>= 0.11.1)
|
|
118
|
-
nokogiri (1.19.
|
|
147
|
+
nokogiri (1.19.4-aarch64-linux-gnu)
|
|
119
148
|
racc (~> 1.4)
|
|
120
|
-
nokogiri (1.19.
|
|
149
|
+
nokogiri (1.19.4-aarch64-linux-musl)
|
|
121
150
|
racc (~> 1.4)
|
|
122
|
-
nokogiri (1.19.
|
|
151
|
+
nokogiri (1.19.4-arm-linux-gnu)
|
|
123
152
|
racc (~> 1.4)
|
|
124
|
-
nokogiri (1.19.
|
|
153
|
+
nokogiri (1.19.4-arm-linux-musl)
|
|
125
154
|
racc (~> 1.4)
|
|
126
|
-
nokogiri (1.19.
|
|
155
|
+
nokogiri (1.19.4-arm64-darwin)
|
|
127
156
|
racc (~> 1.4)
|
|
128
|
-
nokogiri (1.19.
|
|
157
|
+
nokogiri (1.19.4-x86_64-darwin)
|
|
129
158
|
racc (~> 1.4)
|
|
130
|
-
nokogiri (1.19.
|
|
159
|
+
nokogiri (1.19.4-x86_64-linux-gnu)
|
|
131
160
|
racc (~> 1.4)
|
|
132
|
-
nokogiri (1.19.
|
|
161
|
+
nokogiri (1.19.4-x86_64-linux-musl)
|
|
133
162
|
racc (~> 1.4)
|
|
134
163
|
optimist (3.2.1)
|
|
135
164
|
parallel (2.1.0)
|
|
136
|
-
parser (3.3.
|
|
165
|
+
parser (3.3.12.0)
|
|
137
166
|
ast (~> 2.4.1)
|
|
138
167
|
racc
|
|
139
168
|
patience_diff (1.2.0)
|
|
140
169
|
optimist (~> 3.0)
|
|
170
|
+
pp (0.6.4)
|
|
171
|
+
prettyprint
|
|
172
|
+
prettyprint (0.2.0)
|
|
141
173
|
prism (1.9.0)
|
|
142
174
|
public_suffix (7.0.5)
|
|
143
175
|
racc (1.8.1)
|
|
144
176
|
rainbow (3.1.1)
|
|
145
177
|
rake (13.4.2)
|
|
178
|
+
rake-compiler-dock (1.12.0)
|
|
179
|
+
rb_sys (0.9.128)
|
|
180
|
+
rake-compiler-dock (= 1.12.0)
|
|
181
|
+
rbs (4.1.3)
|
|
182
|
+
logger
|
|
183
|
+
prism (>= 1.6.0)
|
|
184
|
+
tsort
|
|
185
|
+
rdoc (8.0.0)
|
|
186
|
+
erb
|
|
187
|
+
prism (>= 1.6.0)
|
|
188
|
+
rbs (>= 4.0.0)
|
|
189
|
+
tsort
|
|
146
190
|
regexp_parser (2.12.0)
|
|
147
|
-
reline (0.
|
|
191
|
+
reline (0.7.0)
|
|
148
192
|
io-console (~> 0.5)
|
|
149
193
|
rexml (3.4.4)
|
|
150
194
|
rspec (3.13.2)
|
|
@@ -160,7 +204,7 @@ GEM
|
|
|
160
204
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
161
205
|
rspec-support (~> 3.13.0)
|
|
162
206
|
rspec-support (3.13.7)
|
|
163
|
-
rubocop (1.
|
|
207
|
+
rubocop (1.89.0)
|
|
164
208
|
json (~> 2.3)
|
|
165
209
|
language_server-protocol (~> 3.17.0.2)
|
|
166
210
|
lint_roller (~> 1.1.0)
|
|
@@ -171,29 +215,26 @@ GEM
|
|
|
171
215
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
172
216
|
ruby-progressbar (~> 1.7)
|
|
173
217
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
174
|
-
rubocop-ast (1.
|
|
218
|
+
rubocop-ast (1.50.0)
|
|
175
219
|
parser (>= 3.3.7.2)
|
|
176
220
|
prism (~> 1.7)
|
|
177
221
|
rubocop-rake (0.7.1)
|
|
178
222
|
lint_roller (~> 1.1)
|
|
179
223
|
rubocop (>= 1.72.1)
|
|
180
|
-
rubocop-rspec (3.
|
|
224
|
+
rubocop-rspec (3.10.2)
|
|
181
225
|
lint_roller (~> 1.1)
|
|
182
|
-
|
|
226
|
+
regexp_parser (>= 2.0)
|
|
227
|
+
rubocop (~> 1.86, >= 1.86.2)
|
|
183
228
|
ruby-progressbar (1.13.0)
|
|
184
229
|
securerandom (0.4.1)
|
|
185
|
-
simplecov (0.
|
|
186
|
-
docile (~> 1.1)
|
|
187
|
-
simplecov-html (~> 0.11)
|
|
188
|
-
simplecov_json_formatter (~> 0.1)
|
|
189
|
-
simplecov-html (0.13.2)
|
|
190
|
-
simplecov_json_formatter (0.1.4)
|
|
230
|
+
simplecov (1.0.3)
|
|
191
231
|
simpleidn (0.2.3)
|
|
192
|
-
super_diff (0.
|
|
193
|
-
attr_extras (>= 6.2.4)
|
|
194
|
-
diff-lcs
|
|
195
|
-
patience_diff
|
|
232
|
+
super_diff (0.19.0)
|
|
233
|
+
attr_extras (>= 6.2.4, < 8)
|
|
234
|
+
diff-lcs (~> 1.5)
|
|
235
|
+
patience_diff (~> 1.2)
|
|
196
236
|
thor (1.5.0)
|
|
237
|
+
tsort (0.2.0)
|
|
197
238
|
tzinfo (2.0.6)
|
|
198
239
|
concurrent-ruby (~> 1.0)
|
|
199
240
|
unicode-display_width (3.2.0)
|
|
@@ -204,7 +245,7 @@ GEM
|
|
|
204
245
|
addressable (>= 2.8.0)
|
|
205
246
|
crack (>= 0.3.2)
|
|
206
247
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
207
|
-
zeitwerk (2.
|
|
248
|
+
zeitwerk (2.8.3)
|
|
208
249
|
|
|
209
250
|
PLATFORMS
|
|
210
251
|
aarch64-linux-gnu
|
|
@@ -218,9 +259,9 @@ PLATFORMS
|
|
|
218
259
|
|
|
219
260
|
DEPENDENCIES
|
|
220
261
|
base64
|
|
221
|
-
byebug
|
|
222
262
|
cocina-models
|
|
223
263
|
datacite!
|
|
264
|
+
debug
|
|
224
265
|
rake (~> 13.0)
|
|
225
266
|
rspec (~> 3.0)
|
|
226
267
|
rubocop (~> 1.7)
|
|
@@ -230,4 +271,4 @@ DEPENDENCIES
|
|
|
230
271
|
webmock (~> 3.13)
|
|
231
272
|
|
|
232
273
|
BUNDLED WITH
|
|
233
|
-
4.0.
|
|
274
|
+
4.0.18
|
data/README.md
CHANGED
|
@@ -117,6 +117,16 @@ validator = Datacite::Validators::AttributesValidator.new(attributes: datacite_a
|
|
|
117
117
|
puts validator.errors.join(', ') unless validator.valid?
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
## Validating cocina locally
|
|
121
|
+
|
|
122
|
+
With cocina json saved from arge (append `.json` to an argo view URL and save the content locally) then run:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
bin/validate-cocina path/to/file.json
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This will result in either a `Valid!` message or an `Invalid!` message with a list of validation errors.
|
|
129
|
+
|
|
120
130
|
## Development
|
|
121
131
|
|
|
122
132
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/bin/validate-cocina
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# This is used to validate if a cocina object will produce
|
|
5
|
+
# a valid datacite payload
|
|
6
|
+
# usage: bin/validate-cocina tmp/druid.json
|
|
7
|
+
|
|
8
|
+
require 'bundler/setup'
|
|
9
|
+
require 'datacite'
|
|
10
|
+
require 'cocina/models'
|
|
11
|
+
require 'json'
|
|
12
|
+
|
|
13
|
+
if ARGV.empty?
|
|
14
|
+
warn "Usage: #{$PROGRAM_NAME} <path-to-cocina-json>"
|
|
15
|
+
exit 1
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
json_path = ARGV[0]
|
|
19
|
+
|
|
20
|
+
unless File.exist?(json_path)
|
|
21
|
+
warn "File not found: #{json_path}"
|
|
22
|
+
exit 1
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
json = JSON.parse(File.read(json_path))
|
|
26
|
+
cocina_object = Cocina::Models::DROWithMetadata.new(json)
|
|
27
|
+
validator = Datacite::Validators::CocinaValidator.new(cocina_object: cocina_object)
|
|
28
|
+
|
|
29
|
+
if validator.valid?
|
|
30
|
+
puts 'Valid!'
|
|
31
|
+
else
|
|
32
|
+
puts 'Invalid:'
|
|
33
|
+
validator.errors.each { |error| puts " - #{error}" }
|
|
34
|
+
exit 1
|
|
35
|
+
end
|
|
@@ -39,26 +39,33 @@ module Datacite
|
|
|
39
39
|
end&.value
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
# @return [String] DataCite resourceType value
|
|
42
|
+
# @return [String, nil] DataCite resourceType value
|
|
43
43
|
def resource_type
|
|
44
|
-
@resource_type ||=
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
@resource_type ||= resource_type_from_subtypes || resource_type_from_type
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def resource_type_from_subtypes
|
|
48
|
+
subtypes = self_deposit_subtypes(self_deposit_form)
|
|
49
|
+
return if subtypes.blank?
|
|
50
|
+
|
|
51
|
+
subtypes.reject { |subtype| subtype == resource_type_general }.join('; ')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def resource_type_from_type
|
|
55
|
+
self_deposit_type(self_deposit_form) || self_deposit_form&.value
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def self_deposit_form
|
|
59
|
+
@self_deposit_form ||= Array(description.form).find { |cocina_form| self_deposit_form?(cocina_form) }
|
|
54
60
|
end
|
|
55
61
|
|
|
56
|
-
#
|
|
57
|
-
#
|
|
62
|
+
# @param cocina_self_deposit_form [Cocina::Models::DescriptiveValue, nil] cocina form element for
|
|
63
|
+
# Stanford self deposit resource types
|
|
64
|
+
# @return [String, nil] the value from the structuredValue when the type is 'type'
|
|
58
65
|
def self_deposit_type(cocina_self_deposit_form)
|
|
59
|
-
cocina_self_deposit_form&.structuredValue&.
|
|
60
|
-
|
|
61
|
-
end
|
|
66
|
+
cocina_self_deposit_form&.structuredValue&.find do |struct_val|
|
|
67
|
+
struct_val.type == 'type'
|
|
68
|
+
end&.value
|
|
62
69
|
end
|
|
63
70
|
|
|
64
71
|
def self_deposit_subtypes(cocina_self_deposit_form)
|
data/lib/datacite/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: datacite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: activesupport
|
|
@@ -98,6 +98,7 @@ files:
|
|
|
98
98
|
- Rakefile
|
|
99
99
|
- bin/console
|
|
100
100
|
- bin/setup
|
|
101
|
+
- bin/validate-cocina
|
|
101
102
|
- datacite.gemspec
|
|
102
103
|
- lib/datacite.rb
|
|
103
104
|
- lib/datacite/autogenerate_doi_request_body.rb
|
|
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
140
141
|
- !ruby/object:Gem::Version
|
|
141
142
|
version: '0'
|
|
142
143
|
requirements: []
|
|
143
|
-
rubygems_version: 3.6.
|
|
144
|
+
rubygems_version: 3.6.9
|
|
144
145
|
specification_version: 4
|
|
145
146
|
summary: A Ruby client library for the DataCite REST API
|
|
146
147
|
test_files: []
|