datacite 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 443df070a95f905f5d8f82cc5b5d1120ae857259acdd275a41ae370f6c9ee769
4
- data.tar.gz: babea5a17ae9a4548bb4ed6f5b0782eb825c2fff926efdfa57be082d5ba03c45
3
+ metadata.gz: ee5281533d561e3ce179796ac1ed4513713dc57c363316f796c8a1d085c2c333
4
+ data.tar.gz: 379a7b690eb7cc4ff1408244e9ef21a70d66c6da31e18140c07c2477059c4be0
5
5
  SHA512:
6
- metadata.gz: 1fe003ed073178d8b9c96604f8c8a2d45159f1423cf23a8499cc24f4da078fbf1e6c0044dde978ca4ca47bbf6a7ece1e1038e54c0170c89e24993ee18b8a67f1
7
- data.tar.gz: b1e7a45cb9c39449464be45292ad2370f253d1c3ea14dac39601f17e6234e68fde6bdcf3c665346d5af241edc65eeb6c7d29de43a35529a8a47a8a375737fe89
6
+ metadata.gz: 399e71f4036b3fcec9ffddbd1db55be088ee8575d9d9a0ba801523de2adec3287332a1fad6fd908c526cf0af4fd67e385881000423e909e81afa2df0f010915d
7
+ data.tar.gz: 79cacf956ecda9284b9a30e17dbbc4ca65fa1b363d2b25a96b862e24b8b90334c92b449130ee87f709e8f063df499a200c5fa04815cfc2eb5cc6685056c36fbd
data/Gemfile.lock CHANGED
@@ -1,10 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datacite (0.1.1)
4
+ datacite (0.2.0)
5
5
  dry-monads (~> 1.3)
6
6
  faraday (~> 1.4)
7
7
  faraday_middleware (~> 1.0)
8
+ json_schema (~> 0.21.0)
8
9
  zeitwerk (~> 2.4)
9
10
 
10
11
  GEM
@@ -17,14 +18,14 @@ GEM
17
18
  crack (0.4.5)
18
19
  rexml
19
20
  diff-lcs (1.4.4)
20
- dry-core (0.7.0)
21
+ dry-core (0.7.1)
21
22
  concurrent-ruby (~> 1.0)
22
23
  dry-equalizer (0.3.0)
23
24
  dry-monads (1.3.5)
24
25
  concurrent-ruby (~> 1.0)
25
26
  dry-core (~> 0.4, >= 0.4.4)
26
27
  dry-equalizer
27
- faraday (1.5.0)
28
+ faraday (1.5.1)
28
29
  faraday-em_http (~> 1.0)
29
30
  faraday-em_synchrony (~> 1.0)
30
31
  faraday-excon (~> 1.1)
@@ -39,11 +40,12 @@ GEM
39
40
  faraday-excon (1.1.0)
40
41
  faraday-httpclient (1.0.1)
41
42
  faraday-net_http (1.0.1)
42
- faraday-net_http_persistent (1.1.0)
43
+ faraday-net_http_persistent (1.2.0)
43
44
  faraday-patron (1.0.0)
44
45
  faraday_middleware (1.0.0)
45
46
  faraday (~> 1.0)
46
47
  hashdiff (1.0.1)
48
+ json_schema (0.21.0)
47
49
  multipart-post (2.1.1)
48
50
  parallel (1.20.1)
49
51
  parser (3.0.1.1)
data/README.md CHANGED
@@ -22,9 +22,51 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
+ ### Initialize the client
25
26
  ```ruby
26
- client = Datacite::Client.new(username: "foo", password: "bar")
27
- result = client.autogenerate_doi
27
+ client = Datacite::Client.new(username: "foo",
28
+ password: "bar",
29
+ host: "api.test.datacite.org")
30
+ ```
31
+
32
+ ### Create a Draft DOI
33
+
34
+ ```ruby
35
+ result = client.register_doi(prefix: '10.0001', suffix: 'bc123df4567')
36
+
37
+ result.either(
38
+ -> response { response.doi },
39
+ -> response { raise("Something went wrong", response.status) }
40
+ )
41
+ ```
42
+
43
+ #### Auto-generated DOI's
44
+
45
+ ```ruby
46
+ result = client.autogenerate_doi(prefix: '10.0001')
47
+
48
+ result.either(
49
+ -> response { response.doi },
50
+ -> response { raise("Something went wrong", response.status) }
51
+ )
52
+ ```
53
+
54
+ ### Update DOI's
55
+
56
+ ```ruby
57
+ # See https://support.datacite.org/reference/dois-2#put_dois-id for the attributes
58
+ attributes = {
59
+ relatedIdentifiers: [
60
+ {
61
+ relatedIdentifier: "https://doi.org/10.xxxx/xxxxx",
62
+ relatedIdentifierType: "DOI",
63
+ relationType: "References",
64
+ resourceTypeGeneral: "Dataset"
65
+ }
66
+ ]
67
+ }
68
+ result = client.update(id: '10.0001/bc123df4567', attributes: attributes)
69
+
28
70
  result.either(
29
71
  -> response { response.doi },
30
72
  -> response { raise("Something went wrong", response.status) }
data/datacite.gemspec CHANGED
@@ -31,5 +31,6 @@ Gem::Specification.new do |spec|
31
31
  spec.add_dependency "dry-monads", "~> 1.3"
32
32
  spec.add_dependency "faraday", "~> 1.4"
33
33
  spec.add_dependency "faraday_middleware", "~> 1.0"
34
+ spec.add_dependency "json_schema", "~> 0.21.0"
34
35
  spec.add_dependency "zeitwerk", "~> 2.4"
35
36
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Datacite
4
- # The JSON request to create a DOI
5
- class AutogenerateDoi
6
- # @param [Prefix] prefix
4
+ # The JSON request to create a random DOI
5
+ class AutogenerateDoiRequestBody
6
+ # @param [String] prefix
7
7
  def initialize(prefix:)
8
8
  @prefix = prefix
9
9
  end
@@ -3,6 +3,7 @@
3
3
  require "faraday"
4
4
  require "faraday_middleware"
5
5
  require "dry/monads"
6
+ require "json_schema"
6
7
 
7
8
  module Datacite
8
9
  # The connection to DataCite API
@@ -23,15 +24,47 @@ module Datacite
23
24
  end
24
25
  end
25
26
 
27
+ # Creates a random DOI
28
+ # @param [String] prefix
26
29
  # @returns [Dry::Monads::Result]
27
30
  def autogenerate_doi(prefix:)
28
- request_body = AutogenerateDoi.new(prefix: prefix).to_json
29
- response = conn.post("/dois", request_body)
31
+ request_body = AutogenerateDoiRequestBody.new(prefix: prefix).to_json
32
+ register(request_body)
33
+ end
34
+
35
+ # Creates a specific DOI
36
+ # @param [String] prefix
37
+ # @param [String] suffix
38
+ # @returns [Dry::Monads::Result]
39
+ def register_doi(prefix:, suffix:)
40
+ request_body = RegisterDoiRequestBody.new(prefix: prefix, suffix: suffix).to_json
41
+ register(request_body)
42
+ end
43
+
44
+ # Update a DOI
45
+ # @param [String] id
46
+ # @param [String] value
47
+ # @returns [Dry::Monads::Result]
48
+ def update(id:, attributes:)
49
+ Validator.validate!(attributes)
50
+ request_body = {
51
+ data: {
52
+ attributes: attributes
53
+ }
54
+ }
55
+
56
+ response = conn.put("/dois/#{id}", request_body.to_json)
30
57
  response.success? ? Success(Response.new(response)) : Failure(response)
31
58
  end
32
59
 
33
60
  private
34
61
 
62
+ # @returns [Dry::Monads::Result]
63
+ def register(request_body)
64
+ response = conn.post("/dois", request_body)
65
+ response.success? ? Success(Response.new(response)) : Failure(response)
66
+ end
67
+
35
68
  def headers
36
69
  {
37
70
  "Content-Type" => "application/vnd.api+json",
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Datacite
4
+ # The JSON request to create a specific DOI
5
+ class RegisterDoiRequestBody
6
+ # @param [String] prefix
7
+ # @param [String] suffix
8
+ def initialize(prefix:, suffix:)
9
+ @prefix = prefix
10
+ @suffix = suffix
11
+ end
12
+
13
+ # @returns [Hash]
14
+ def to_json(*_args)
15
+ {
16
+ data: {
17
+ type: "dois",
18
+ attributes: {
19
+ doi: "#{prefix}/#{suffix}"
20
+ }
21
+ }
22
+ }
23
+ end
24
+
25
+ private
26
+
27
+ attr_reader :prefix, :suffix
28
+ end
29
+ end
@@ -0,0 +1,474 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+
4
+ "definitions": {
5
+ "nameType": {
6
+ "type": "string",
7
+ "enum": [
8
+ "Organizational",
9
+ "Personal"
10
+ ]
11
+ },
12
+ "nameIdentifiers": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "object",
16
+ "properties": {
17
+ "nameIdentifier": {"type": "string"},
18
+ "nameIdentifierScheme": {"type": "string"},
19
+ "schemeURI": {"type": "string", "format": "uri"}
20
+ },
21
+ "required": ["nameIdentifier", "nameIdentifierScheme"]
22
+ },
23
+ "uniqueItems": true
24
+ },
25
+ "affiliations": {
26
+ "type": "array",
27
+ "items": {
28
+ "type": "object",
29
+ "properties": {
30
+ "affiliation": {"type": "string"}
31
+ },
32
+ "required": ["affiliation"]
33
+ },
34
+ "uniqueItems": true
35
+ },
36
+ "titleType": {
37
+ "type": "string",
38
+ "enum": [
39
+ "AlternativeTitle",
40
+ "Subtitle",
41
+ "TranslatedTitle",
42
+ "Other"
43
+ ]
44
+ },
45
+ "contributorType": {
46
+ "type": "string",
47
+ "enum": [
48
+ "ContactPerson",
49
+ "DataCollector",
50
+ "DataCurator",
51
+ "DataManager",
52
+ "Distributor",
53
+ "Editor",
54
+ "HostingInstitution",
55
+ "Producer",
56
+ "ProjectLeader",
57
+ "ProjectManager",
58
+ "ProjectMember",
59
+ "RegistrationAgency",
60
+ "RegistrationAuthority",
61
+ "RelatedPerson",
62
+ "Researcher",
63
+ "ResearchGroup",
64
+ "RightsHolder",
65
+ "Sponsor",
66
+ "Supervisor",
67
+ "WorkPackageLeader",
68
+ "Other"
69
+ ]
70
+ },
71
+ "date": {
72
+ "type": "string",
73
+ "anyOf": [
74
+ {"format": "date"},
75
+ {"format": "date-time"}
76
+ ]
77
+ },
78
+ "dateType": {
79
+ "type": "string",
80
+ "enum": [
81
+ "Accepted",
82
+ "Available",
83
+ "Copyrighted",
84
+ "Collected",
85
+ "Created",
86
+ "Issued",
87
+ "Submitted",
88
+ "Updated",
89
+ "Valid",
90
+ "Withdrawn",
91
+ "Other"
92
+ ]
93
+ },
94
+ "resourceTypeGeneral": {
95
+ "type": "string",
96
+ "enum": [
97
+ "Audiovisual",
98
+ "Collection",
99
+ "DataPaper",
100
+ "Dataset",
101
+ "Event",
102
+ "Image",
103
+ "InteractiveResource",
104
+ "Model",
105
+ "PhysicalObject",
106
+ "Service",
107
+ "Software",
108
+ "Sound",
109
+ "Text",
110
+ "Workflow",
111
+ "Other"
112
+ ]
113
+ },
114
+ "relatedIdentifierType": {
115
+ "type": "string",
116
+ "enum": [
117
+ "ARK",
118
+ "arXiv",
119
+ "bibcode",
120
+ "DOI",
121
+ "EAN13",
122
+ "EISSN",
123
+ "Handle",
124
+ "IGSN",
125
+ "ISBN",
126
+ "ISSN",
127
+ "ISTC",
128
+ "LISSN",
129
+ "LSID",
130
+ "PMID",
131
+ "PURL",
132
+ "UPC",
133
+ "URL",
134
+ "URN",
135
+ "w3id"
136
+ ]
137
+ },
138
+ "relationType": {
139
+ "type": "string",
140
+ "enum": [
141
+ "IsCitedBy",
142
+ "Cites",
143
+ "IsSupplementTo",
144
+ "IsSupplementedBy",
145
+ "IsContinuedBy",
146
+ "Continues",
147
+ "IsDescribedBy",
148
+ "Describes",
149
+ "HasMetadata",
150
+ "IsMetadataFor",
151
+ "HasVersion",
152
+ "IsVersionOf",
153
+ "IsNewVersionOf",
154
+ "IsPreviousVersionOf",
155
+ "IsPartOf",
156
+ "HasPart",
157
+ "IsReferencedBy",
158
+ "References",
159
+ "IsDocumentedBy",
160
+ "Documents",
161
+ "IsCompiledBy",
162
+ "Compiles",
163
+ "IsVariantFormOf",
164
+ "IsOriginalFormOf",
165
+ "IsIdenticalTo",
166
+ "IsReviewedBy",
167
+ "Reviews",
168
+ "IsDerivedFrom",
169
+ "IsSourceOf",
170
+ "IsRequiredBy",
171
+ "Requires",
172
+ "IsObsoletedBy",
173
+ "Obsoletes"
174
+ ]
175
+ },
176
+ "descriptionType": {
177
+ "type": "string",
178
+ "enum": [
179
+ "Abstract",
180
+ "Methods",
181
+ "SeriesInformation",
182
+ "TableOfContents",
183
+ "TechnicalInfo",
184
+ "Other"
185
+ ]
186
+ },
187
+ "geoLocationPoint": {
188
+ "type": "object",
189
+ "properties": {
190
+ "pointLongitude": {"$ref": "#/definitions/longitude"},
191
+ "pointLatitude": {"$ref": "#/definitions/latitude"}
192
+ },
193
+ "required": ["pointLongitude", "pointLatitude"]
194
+ },
195
+ "longitude": {
196
+ "type": "number",
197
+ "minimum": -180,
198
+ "maximum": 180
199
+ },
200
+ "latitude": {
201
+ "type": "number",
202
+ "minimum": -90,
203
+ "maximum": 90
204
+ },
205
+ "funderIdentifierType": {
206
+ "type": "string",
207
+ "enum": [
208
+ "ISNI",
209
+ "GRID",
210
+ "Crossref Funder ID",
211
+ "Other"
212
+ ]
213
+ }
214
+ },
215
+
216
+ "type": "object",
217
+
218
+ "properties": {
219
+ "types": {
220
+ "type": "object",
221
+ "properties": {
222
+ "resourceType": {"type": "string"},
223
+ "resourceTypeGeneral": {"$ref": "#/definitions/resourceTypeGeneral"}
224
+ },
225
+ "required": ["resourceType", "resourceTypeGeneral"]
226
+ },
227
+ "identifiers": {
228
+ "type": "array",
229
+ "items":{
230
+ "type": "object",
231
+ "properties": {
232
+ "identifier": {"type": "string"},
233
+ "identifierType": {"type": "string"}
234
+ },
235
+ "required": ["identifier", "identifierType"]
236
+ },
237
+ "minItems": 1,
238
+ "uniqueItems": true
239
+ },
240
+ "creators": {
241
+ "type": "array",
242
+ "items": {
243
+ "type": "object",
244
+ "properties": {
245
+ "name": {"type": "string"},
246
+ "nameType": {"$ref": "#/definitions/nameType"},
247
+ "givenName": {"type": "string"},
248
+ "familyName": {"type": "string"},
249
+ "nameIdentifiers": {"$ref": "#/definitions/nameIdentifiers"},
250
+ "affiliations": {"$ref": "#/definitions/affiliations"},
251
+ "lang": {"type": "string"}
252
+ },
253
+ "required": ["name"]
254
+ },
255
+ "minItems": 1,
256
+ "uniqueItems": true
257
+ },
258
+ "titles": {
259
+ "type": "array",
260
+ "items": {
261
+ "type": "object",
262
+ "properties": {
263
+ "title": {"type": "string"},
264
+ "titleType": {"$ref": "#/definitions/titleType"},
265
+ "lang": {"type": "string"}
266
+ },
267
+ "required": ["title"]
268
+ },
269
+ "minItems": 1,
270
+ "uniqueItems": true
271
+ },
272
+ "publisher": {
273
+ "type": "string"
274
+ },
275
+ "publicationYear": {
276
+ "type": "string"
277
+ },
278
+ "subjects": {
279
+ "type": "array",
280
+ "items": {
281
+ "type": "object",
282
+ "properties": {
283
+ "subject": {"type": "string"},
284
+ "subjectScheme": {"type": "string"},
285
+ "schemeURI": {"type": "string", "format": "uri"},
286
+ "valueURI": {"type": "string", "format": "uri"},
287
+ "lang": {"type": "string"}
288
+ },
289
+ "required": ["subject"]
290
+ },
291
+ "uniqueItems": true
292
+ },
293
+ "contributors": {
294
+ "type": "array",
295
+ "items": {
296
+ "type": "object",
297
+ "properties": {
298
+ "contributorType": {"$ref": "#/definitions/contributorType"},
299
+ "name": {"type": "string"},
300
+ "nameType": {"$ref": "#/definitions/nameType"},
301
+ "givenName": {"type": "string"},
302
+ "familyName": {"type": "string"},
303
+ "nameIdentifiers": {"$ref": "#/definitions/nameIdentifiers"},
304
+ "affiliations": {"$ref": "#/definitions/affiliations"},
305
+ "lang": {"type": "string"}
306
+ },
307
+ "required": ["contributorType", "name"]
308
+ },
309
+ "uniqueItems": true
310
+ },
311
+ "dates": {
312
+ "type": "array",
313
+ "items": {
314
+ "type": "object",
315
+ "properties": {
316
+ "date": {"$ref": "#/definitions/date"},
317
+ "dateType": {"$ref": "#/definitions/dateType"},
318
+ "dateInformation": {"type": "string"}
319
+ },
320
+ "required": ["date", "dateType"]
321
+ },
322
+ "uniqueItems": true
323
+ },
324
+ "language": {
325
+ "type": "string",
326
+ "$comment": "Primary language of the resource. Allowed values are taken from IETF BCP 47, ISO 639-1 language codes."
327
+ },
328
+ "alternateIdentifiers": {
329
+ "type": "array",
330
+ "items": {
331
+ "type": "object",
332
+ "properties": {
333
+ "alternateIdentifier": {"type": "string"},
334
+ "alternateIdentifierType": {"type": "string"}
335
+ },
336
+ "required": ["alternateIdentifier", "alternateIdentifierType"]
337
+ },
338
+ "uniqueItems": true
339
+ },
340
+ "relatedIdentifiers": {
341
+ "type": "array",
342
+ "items": {
343
+ "type": "object",
344
+ "properties": {
345
+ "relatedIdentifier": {"type": "string"},
346
+ "relatedIdentifierType": {"$ref": "#/definitions/relatedIdentifierType"},
347
+ "relationType": {"$ref": "#/definitions/relationType"},
348
+ "relatedMetadataScheme": {"type": "string"},
349
+ "schemeURI": {"type": "string", "format": "uri"},
350
+ "schemeType": {"type": "string"},
351
+ "resourceTypeGeneral": {"$ref": "#/definitions/resourceTypeGeneral"}
352
+ },
353
+ "required": ["relatedIdentifier", "relatedIdentifierType", "relationType"],
354
+ "if": {
355
+ "properties": {
356
+ "relationType": {"enum": ["HasMetadata", "IsMetadataFor"]}
357
+ }
358
+ },
359
+ "else": {
360
+ "$comment": "these properties may only be used with relation types HasMetadata/IsMetadataFor",
361
+ "properties": {
362
+ "relatedMetadataScheme": false,
363
+ "schemeURI": false,
364
+ "schemeType": false
365
+ }
366
+ }
367
+ },
368
+ "uniqueItems": true
369
+ },
370
+ "sizes": {
371
+ "type": "array",
372
+ "items": {
373
+ "type": "string"
374
+ },
375
+ "uniqueItems": true
376
+ },
377
+ "formats": {
378
+ "type": "array",
379
+ "items": {
380
+ "type": "string"
381
+ },
382
+ "uniqueItems": true
383
+ },
384
+ "version": {
385
+ "type": "string"
386
+ },
387
+ "rightsList": {
388
+ "type": "array",
389
+ "items": {
390
+ "type": "object",
391
+ "properties": {
392
+ "rights": {"type": "string"},
393
+ "rightsURI": {"type": "string", "format": "uri"},
394
+ "rightsIdentifier": {"type": "string"},
395
+ "rightsIdentifierScheme": {"type": "string"},
396
+ "schemeURI": {"type": "string", "format": "uri"},
397
+ "lang": {"type": "string"}
398
+ }
399
+ },
400
+ "uniqueItems": true
401
+ },
402
+ "descriptions": {
403
+ "type": "array",
404
+ "items": {
405
+ "type": "object",
406
+ "properties": {
407
+ "description": {"type": "string"},
408
+ "descriptionType": {"$ref": "#/definitions/descriptionType"},
409
+ "lang": {"type": "string"}
410
+ },
411
+ "required": ["description", "descriptionType"]
412
+ },
413
+ "uniqueItems": true
414
+ },
415
+ "geoLocations": {
416
+ "type": "array",
417
+ "items": {
418
+ "type": "object",
419
+ "properties": {
420
+ "geoLocationPlace": {"type": "string"},
421
+ "geoLocationPoint": {"$ref": "#/definitions/geoLocationPoint"},
422
+ "geoLocationBox": {
423
+ "type": "object",
424
+ "properties": {
425
+ "westBoundLongitude": {"$ref": "#/definitions/longitude"},
426
+ "eastBoundLongitude": {"$ref": "#/definitions/longitude"},
427
+ "southBoundLatitude": {"$ref": "#/definitions/latitude"},
428
+ "northBoundLatitude": {"$ref": "#/definitions/latitude"}
429
+ },
430
+ "required": ["westBoundLongitude", "eastBoundLongitude", "southBoundLatitude", "northBoundLatitude"]
431
+ },
432
+ "geoLocationPolygons": {
433
+ "type": "array",
434
+ "items": {
435
+ "type": "object",
436
+ "properties": {
437
+ "polygonPoints": {
438
+ "type": "array",
439
+ "items": {"$ref": "#/definitions/geoLocationPoint"},
440
+ "minItems": 4
441
+ },
442
+ "inPolygonPoint": {"$ref": "#/definitions/geoLocationPoint"}
443
+ },
444
+ "required": ["polygonPoints"]
445
+ },
446
+ "uniqueItems": true
447
+ }
448
+ }
449
+ },
450
+ "uniqueItems": true
451
+ },
452
+ "fundingReferences": {
453
+ "type": "array",
454
+ "items": {
455
+ "type": "object",
456
+ "properties": {
457
+ "funderName": {"type": "string"},
458
+ "funderIdentifier": {"type": "string"},
459
+ "funderIdentifierType": {"$ref": "#/definitions/funderIdentifierType"},
460
+ "awardNumber": {"type": "string"},
461
+ "awardURI": {"type": "string", "format": "uri"},
462
+ "awardTitle": {"type": "string"}
463
+ },
464
+ "required": ["funderName"]
465
+ },
466
+ "uniqueItems": true
467
+ },
468
+ "schemaVersion": {
469
+ "type": "string",
470
+ "const": "http://datacite.org/schema/kernel-4"
471
+ }
472
+ },
473
+ "additionalProperties": false
474
+ }
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json_schema"
4
+
5
+ module Datacite
6
+ # Validates the request data is valid
7
+ class Validator
8
+ def self.validate!(data)
9
+ # Schema from https://github.com/datacite/schema/blob/master/source/json/kernel-4.3/datacite_4.3_schema.json
10
+ # with changes:
11
+ # 1. Remove invalid formats https://github.com/datacite/schema/issues/96
12
+ # 2. Remove required fields https://github.com/datacite/schema/issues/97
13
+ # 3. Added "additionalProperties": false
14
+
15
+ schema_data = JSON.parse(File.read("#{__dir__}/schema.json"))
16
+ schema = JsonSchema.parse!(schema_data)
17
+ schema.validate!(data)
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Datacite
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: json_schema
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.21.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.21.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: zeitwerk
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -85,9 +99,12 @@ files:
85
99
  - bin/setup
86
100
  - datacite.gemspec
87
101
  - lib/datacite.rb
88
- - lib/datacite/autogenerate_doi.rb
102
+ - lib/datacite/autogenerate_doi_request_body.rb
89
103
  - lib/datacite/client.rb
104
+ - lib/datacite/register_doi_request_body.rb
90
105
  - lib/datacite/response.rb
106
+ - lib/datacite/schema.json
107
+ - lib/datacite/validator.rb
91
108
  - lib/datacite/version.rb
92
109
  homepage: https://github.com/sul-dlss/datacite-ruby
93
110
  licenses: []