datacite 0.5.0 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14e944d80dc95aa79554d485193762732d942e6b17cc039cbd88bd2a390b9289
4
- data.tar.gz: 7358ac61628a052e33c3bd82da253451135e87a9e584695b28022d33801ae0df
3
+ metadata.gz: 66112a3d3c17ff31745747464ca733f9154f41e1b135a9494a85f5a3c113c3d1
4
+ data.tar.gz: 77b577598b0e2ce56ef4123c6f8353d1079c254c43b2613898702e25f40a971b
5
5
  SHA512:
6
- metadata.gz: 6fd39012378ac1312ae25e38ac72797f58daec08db118b94548f898be989d5ef2a2dcf6e55d1a513333bc73ca21beeea32cf92387c312c6f1eb29cc906afb942
7
- data.tar.gz: 3efbef3e7d82b69ba1b2c5df6c2b9423b0a618c10e41dba770e5102581fa5f4b75fa12b552b280de011d126211bab4cc89e343c6ce7c32f4a2704b2ed43c019d
6
+ metadata.gz: 18f4f54d95b7cfc2678a2068fd2a084c48d12707f451d5b8d5f84a9978a6a6d9d9739d3a21e5284cc25de3637124a46d597ab00b9e998e496afbaca11849d7d7
7
+ data.tar.gz: 90eb6d4920b6f4006c4bf0a2e0ffbca77c8fdc3abc0160400a5a7ba3ab2124075f6f12401a8e64b5e16318551bdac633bc2e91a95e996cc71483050d4f2d1c84
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ plugins:
3
3
  - rubocop-rspec
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 3.0
6
+ TargetRubyVersion: 3.4
7
7
 
8
8
  Metrics/BlockLength:
9
9
  Exclude:
@@ -16,14 +16,6 @@ RSpec/MultipleExpectations:
16
16
  RSpec/MultipleMemoizedHelpers:
17
17
  Enabled: false
18
18
 
19
- Style/StringLiterals:
20
- Enabled: true
21
- EnforcedStyle: double_quotes
22
-
23
- Style/StringLiteralsInInterpolation:
24
- Enabled: true
25
- EnforcedStyle: double_quotes
26
-
27
19
  Layout/LineLength:
28
20
  Max: 120
29
21
 
@@ -335,3 +327,30 @@ Style/SendWithLiteralMethodName: # new in 1.64
335
327
  Enabled: true
336
328
  Style/SuperArguments: # new in 1.64
337
329
  Enabled: true
330
+
331
+ Gemspec/AttributeAssignment: # new in 1.77
332
+ Enabled: true
333
+ Layout/EmptyLinesAfterModuleInclusion: # new in 1.79
334
+ Enabled: true
335
+ Lint/UselessDefaultValueArgument: # new in 1.76
336
+ Enabled: true
337
+ Lint/UselessOr: # new in 1.76
338
+ Enabled: true
339
+ Naming/PredicateMethod: # new in 1.76
340
+ Enabled: true
341
+ Style/ArrayIntersectWithSingleElement: # new in 1.81
342
+ Enabled: true
343
+ Style/CollectionQuerying: # new in 1.77
344
+ Enabled: true
345
+ Style/ComparableBetween: # new in 1.74
346
+ Enabled: true
347
+ Style/EmptyStringInsideInterpolation: # new in 1.76
348
+ Enabled: true
349
+ Style/HashFetchChain: # new in 1.75
350
+ Enabled: true
351
+ Style/ItBlockParameter: # new in 1.75
352
+ Enabled: true
353
+ Style/RedundantArrayFlatten: # new in 1.76
354
+ Enabled: true
355
+ RSpec/IncludeExamples: # new in 3.6
356
+ Enabled: true
data/Gemfile CHANGED
@@ -1,17 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in datacite.gemspec
6
6
  gemspec
7
7
 
8
8
  # Specify development dependencies here
9
- gem "base64"
10
- gem "byebug"
11
- gem "rake", "~> 13.0"
12
- gem "rspec", "~> 3.0"
13
- gem "rubocop", "~> 1.7"
14
- gem "rubocop-rake"
15
- gem "rubocop-rspec"
16
- gem "simplecov"
17
- gem "webmock", "~> 3.13"
9
+ gem 'base64'
10
+ gem 'byebug'
11
+ gem 'rake', '~> 13.0'
12
+ gem 'rspec', '~> 3.0'
13
+ gem 'rubocop', '~> 1.7'
14
+ gem 'rubocop-rake'
15
+ gem 'rubocop-rspec'
16
+ gem 'simplecov'
17
+ gem 'webmock', '~> 3.13'
data/Gemfile.lock CHANGED
@@ -1,10 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datacite (0.5.0)
4
+ datacite (0.7.0)
5
5
  dry-monads (~> 1.3)
6
6
  faraday (~> 2.0)
7
- json_schema (~> 0.21.0)
8
7
  zeitwerk (~> 2.4)
9
8
 
10
9
  GEM
@@ -13,62 +12,61 @@ GEM
13
12
  addressable (2.8.7)
14
13
  public_suffix (>= 2.0.2, < 7.0)
15
14
  ast (2.4.3)
16
- base64 (0.2.0)
17
- bigdecimal (3.1.9)
15
+ base64 (0.3.0)
16
+ bigdecimal (3.3.1)
18
17
  byebug (12.0.0)
19
18
  concurrent-ruby (1.3.5)
20
19
  crack (1.0.0)
21
20
  bigdecimal
22
21
  rexml
23
- diff-lcs (1.6.1)
22
+ diff-lcs (1.6.2)
24
23
  docile (1.4.1)
25
24
  dry-core (1.1.0)
26
25
  concurrent-ruby (~> 1.0)
27
26
  logger
28
27
  zeitwerk (~> 2.6)
29
- dry-monads (1.8.3)
28
+ dry-monads (1.9.0)
30
29
  concurrent-ruby (~> 1.0)
31
30
  dry-core (~> 1.1)
32
31
  zeitwerk (~> 2.6)
33
- faraday (2.13.1)
32
+ faraday (2.14.0)
34
33
  faraday-net_http (>= 2.0, < 3.5)
35
34
  json
36
35
  logger
37
- faraday-net_http (3.4.0)
36
+ faraday-net_http (3.4.1)
38
37
  net-http (>= 0.5.0)
39
- hashdiff (1.1.2)
40
- json (2.11.3)
41
- json_schema (0.21.0)
42
- language_server-protocol (3.17.0.4)
38
+ hashdiff (1.2.1)
39
+ json (2.15.1)
40
+ language_server-protocol (3.17.0.5)
43
41
  lint_roller (1.1.0)
44
42
  logger (1.7.0)
45
43
  net-http (0.6.0)
46
44
  uri
47
45
  parallel (1.27.0)
48
- parser (3.3.8.0)
46
+ parser (3.3.9.0)
49
47
  ast (~> 2.4.1)
50
48
  racc
51
- prism (1.4.0)
52
- public_suffix (6.0.1)
49
+ prism (1.6.0)
50
+ public_suffix (6.0.2)
53
51
  racc (1.8.1)
54
52
  rainbow (3.1.1)
55
- rake (13.2.1)
56
- regexp_parser (2.10.0)
57
- rexml (3.4.1)
58
- rspec (3.13.0)
53
+ rake (13.3.0)
54
+ regexp_parser (2.11.3)
55
+ rexml (3.4.4)
56
+ rspec (3.13.1)
59
57
  rspec-core (~> 3.13.0)
60
58
  rspec-expectations (~> 3.13.0)
61
59
  rspec-mocks (~> 3.13.0)
62
- rspec-core (3.13.3)
60
+ rspec-core (3.13.6)
63
61
  rspec-support (~> 3.13.0)
64
- rspec-expectations (3.13.3)
62
+ rspec-expectations (3.13.5)
65
63
  diff-lcs (>= 1.2.0, < 2.0)
66
64
  rspec-support (~> 3.13.0)
67
- rspec-mocks (3.13.2)
65
+ rspec-mocks (3.13.6)
68
66
  diff-lcs (>= 1.2.0, < 2.0)
69
67
  rspec-support (~> 3.13.0)
70
- rspec-support (3.13.2)
71
- rubocop (1.75.3)
68
+ rspec-support (3.13.6)
69
+ rubocop (1.81.1)
72
70
  json (~> 2.3)
73
71
  language_server-protocol (~> 3.17.0.2)
74
72
  lint_roller (~> 1.1.0)
@@ -76,16 +74,16 @@ GEM
76
74
  parser (>= 3.3.0.2)
77
75
  rainbow (>= 2.2.2, < 4.0)
78
76
  regexp_parser (>= 2.9.3, < 3.0)
79
- rubocop-ast (>= 1.44.0, < 2.0)
77
+ rubocop-ast (>= 1.47.1, < 2.0)
80
78
  ruby-progressbar (~> 1.7)
81
79
  unicode-display_width (>= 2.4.0, < 4.0)
82
- rubocop-ast (1.44.1)
80
+ rubocop-ast (1.47.1)
83
81
  parser (>= 3.3.7.2)
84
82
  prism (~> 1.4)
85
83
  rubocop-rake (0.7.1)
86
84
  lint_roller (~> 1.1)
87
85
  rubocop (>= 1.72.1)
88
- rubocop-rspec (3.6.0)
86
+ rubocop-rspec (3.7.0)
89
87
  lint_roller (~> 1.1)
90
88
  rubocop (~> 1.72, >= 1.72.1)
91
89
  ruby-progressbar (1.13.0)
@@ -93,17 +91,17 @@ GEM
93
91
  docile (~> 1.1)
94
92
  simplecov-html (~> 0.11)
95
93
  simplecov_json_formatter (~> 0.1)
96
- simplecov-html (0.13.1)
94
+ simplecov-html (0.13.2)
97
95
  simplecov_json_formatter (0.1.4)
98
- unicode-display_width (3.1.4)
99
- unicode-emoji (~> 4.0, >= 4.0.4)
100
- unicode-emoji (4.0.4)
101
- uri (1.0.3)
96
+ unicode-display_width (3.2.0)
97
+ unicode-emoji (~> 4.1)
98
+ unicode-emoji (4.1.0)
99
+ uri (1.0.4)
102
100
  webmock (3.25.1)
103
101
  addressable (>= 2.8.0)
104
102
  crack (>= 0.3.2)
105
103
  hashdiff (>= 0.4.0, < 2.0.0)
106
- zeitwerk (2.7.2)
104
+ zeitwerk (2.7.3)
107
105
 
108
106
  PLATFORMS
109
107
  arm64-darwin-23
@@ -126,4 +124,4 @@ DEPENDENCIES
126
124
  webmock (~> 3.13)
127
125
 
128
126
  BUNDLED WITH
129
- 2.6.8
127
+ 2.7.2
data/LICENSE ADDED
@@ -0,0 +1,174 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
data/README.md CHANGED
@@ -97,15 +97,6 @@ result.either(
97
97
  )
98
98
  ```
99
99
 
100
- ### Validation
101
- This gem validates using a json schema from https://github.com/datacite/schema/blob/master/source/json/kernel-4.3/datacite_4.3_schema.json
102
-
103
- We've made the following changes:
104
- * relax the required fields (https://github.com/datacite/schema/issues/97)
105
- * add event property (https://github.com/datacite/schema/issues/100)
106
- * add url property (https://github.com/datacite/schema/issues/101)
107
- * add xml property to support Datacite 4.4 xml schema via the api (https://github.com/datacite/schema/issues/99)
108
-
109
100
  ## Development
110
101
 
111
102
  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/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
5
 
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
- require "rubocop/rake_task"
8
+ require 'rubocop/rake_task'
9
9
 
10
10
  RuboCop::RakeTask.new
11
11
 
data/bin/console CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "bundler/setup"
5
- require "datacite"
4
+ require 'bundler/setup'
5
+ require 'datacite'
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -11,5 +11,5 @@ require "datacite"
11
11
  # require "pry"
12
12
  # Pry.start
13
13
 
14
- require "irb"
14
+ require 'irb'
15
15
  IRB.start(__FILE__)
data/datacite.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lib/datacite/version"
3
+ require_relative 'lib/datacite/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "datacite"
6
+ spec.name = 'datacite'
7
7
  spec.version = Datacite::VERSION
8
- spec.authors = ["Justin Coyne"]
9
- spec.email = ["jcoyne@justincoyne.com"]
8
+ spec.authors = ['Justin Coyne']
9
+ spec.email = ['jcoyne@justincoyne.com']
10
10
 
11
- spec.summary = "A Ruby client library for the DataCite REST API "
12
- spec.description = "See https://support.datacite.org/docs/api"
13
- spec.homepage = "https://github.com/sul-dlss/datacite-ruby"
14
- spec.required_ruby_version = ">= 3.0"
11
+ spec.summary = 'A Ruby client library for the DataCite REST API '
12
+ spec.description = 'See https://support.datacite.org/docs/api'
13
+ spec.homepage = 'https://github.com/sul-dlss/datacite-ruby'
14
+ spec.required_ruby_version = '>= 3.4'
15
15
 
16
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
17
17
 
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = spec.homepage
18
+ spec.metadata['homepage_uri'] = spec.homepage
19
+ spec.metadata['source_code_uri'] = spec.homepage
20
20
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
@@ -24,13 +24,12 @@ Gem::Specification.new do |spec|
24
24
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
25
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
26
26
  end
27
- spec.bindir = "exe"
27
+ spec.bindir = 'exe'
28
28
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
29
+ spec.require_paths = ['lib']
30
30
 
31
- spec.add_dependency "dry-monads", "~> 1.3"
32
- spec.add_dependency "faraday", "~> 2.0"
33
- spec.add_dependency "json_schema", "~> 0.21.0"
34
- spec.add_dependency "zeitwerk", "~> 2.4"
35
- spec.metadata["rubygems_mfa_required"] = "true"
31
+ spec.add_dependency 'dry-monads', '~> 1.3'
32
+ spec.add_dependency 'faraday', '~> 2.0'
33
+ spec.add_dependency 'zeitwerk', '~> 2.4'
34
+ spec.metadata['rubygems_mfa_required'] = 'true'
36
35
  end
@@ -12,7 +12,7 @@ module Datacite
12
12
  def to_json(*_args)
13
13
  {
14
14
  data: {
15
- type: "dois",
15
+ type: 'dois',
16
16
  attributes: {
17
17
  prefix: prefix
18
18
  }
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "faraday"
4
- require "dry/monads"
5
- require "json_schema"
3
+ require 'faraday'
4
+ require 'dry/monads'
6
5
 
7
6
  module Datacite
8
7
  # The connection to DataCite API
@@ -12,7 +11,7 @@ module Datacite
12
11
  # @param [String] username
13
12
  # @param [String] password
14
13
  # @param [String] host
15
- def initialize(username: nil, password: nil, host: "api.test.datacite.org")
14
+ def initialize(username: nil, password: nil, host: 'api.test.datacite.org')
16
15
  @conn = Faraday.new(
17
16
  url: "https://#{host}",
18
17
  headers: headers
@@ -45,7 +44,6 @@ module Datacite
45
44
  # @param [String] value
46
45
  # @returns [Dry::Monads::Result]
47
46
  def update(id:, attributes:)
48
- Validator.validate!(attributes)
49
47
  request_body = {
50
48
  data: {
51
49
  attributes: attributes
@@ -87,14 +85,14 @@ module Datacite
87
85
 
88
86
  # @returns [Dry::Monads::Result]
89
87
  def register(request_body)
90
- response = conn.post("/dois", request_body)
88
+ response = conn.post('/dois', request_body)
91
89
  response.success? ? Success(Response.new(response)) : Failure(response)
92
90
  end
93
91
 
94
92
  def headers
95
93
  {
96
- "Content-Type" => "application/vnd.api+json",
97
- "User-Agent" => "Datacite Ruby client version #{Datacite::VERSION}"
94
+ 'Content-Type' => 'application/vnd.api+json',
95
+ 'User-Agent' => "Datacite Ruby client version #{Datacite::VERSION}"
98
96
  }
99
97
  end
100
98
 
@@ -14,7 +14,7 @@ module Datacite
14
14
  def to_json(*_args)
15
15
  {
16
16
  data: {
17
- type: "dois",
17
+ type: 'dois',
18
18
  attributes: {
19
19
  doi: "#{prefix}/#{suffix}"
20
20
  }
@@ -11,7 +11,7 @@ module Datacite
11
11
  attr_reader :body
12
12
 
13
13
  def doi
14
- body.dig("data", "id")
14
+ body.dig('data', 'id')
15
15
  end
16
16
  end
17
17
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Datacite
4
- VERSION = "0.5.0"
4
+ VERSION = '0.7.0'
5
5
  end
data/lib/datacite.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "zeitwerk"
3
+ require 'zeitwerk'
4
4
 
5
5
  Zeitwerk::Loader.for_gem.setup
6
6
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datacite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-05-02 00:00:00.000000000 Z
10
+ date: 2025-10-22 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dry-monads
@@ -38,20 +37,6 @@ dependencies:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
39
  version: '2.0'
41
- - !ruby/object:Gem::Dependency
42
- name: json_schema
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.21.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.21.0
55
40
  - !ruby/object:Gem::Dependency
56
41
  name: zeitwerk
57
42
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +65,7 @@ files:
80
65
  - ".rubocop.yml"
81
66
  - Gemfile
82
67
  - Gemfile.lock
68
+ - LICENSE
83
69
  - README.md
84
70
  - Rakefile
85
71
  - bin/console
@@ -90,8 +76,6 @@ files:
90
76
  - lib/datacite/client.rb
91
77
  - lib/datacite/register_doi_request_body.rb
92
78
  - lib/datacite/response.rb
93
- - lib/datacite/schema.json
94
- - lib/datacite/validator.rb
95
79
  - lib/datacite/version.rb
96
80
  homepage: https://github.com/sul-dlss/datacite-ruby
97
81
  licenses: []
@@ -100,7 +84,6 @@ metadata:
100
84
  homepage_uri: https://github.com/sul-dlss/datacite-ruby
101
85
  source_code_uri: https://github.com/sul-dlss/datacite-ruby
102
86
  rubygems_mfa_required: 'true'
103
- post_install_message:
104
87
  rdoc_options: []
105
88
  require_paths:
106
89
  - lib
@@ -108,15 +91,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
91
  requirements:
109
92
  - - ">="
110
93
  - !ruby/object:Gem::Version
111
- version: '3.0'
94
+ version: '3.4'
112
95
  required_rubygems_version: !ruby/object:Gem::Requirement
113
96
  requirements:
114
97
  - - ">="
115
98
  - !ruby/object:Gem::Version
116
99
  version: '0'
117
100
  requirements: []
118
- rubygems_version: 3.5.11
119
- signing_key:
101
+ rubygems_version: 3.6.2
120
102
  specification_version: 4
121
103
  summary: A Ruby client library for the DataCite REST API
122
104
  test_files: []
@@ -1,484 +0,0 @@
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
- "event": {
220
- "type": "string",
221
- "enum": ["publish", "register", "hide"]
222
- },
223
- "url": {
224
- "type": "string"
225
- },
226
- "types": {
227
- "type": "object",
228
- "properties": {
229
- "resourceType": {"type": "string"},
230
- "resourceTypeGeneral": {"$ref": "#/definitions/resourceTypeGeneral"}
231
- },
232
- "required": ["resourceType", "resourceTypeGeneral"]
233
- },
234
- "identifiers": {
235
- "type": "array",
236
- "items":{
237
- "type": "object",
238
- "properties": {
239
- "identifier": {"type": "string"},
240
- "identifierType": {"type": "string"}
241
- },
242
- "required": ["identifier", "identifierType"]
243
- },
244
- "minItems": 1,
245
- "uniqueItems": true
246
- },
247
- "creators": {
248
- "type": "array",
249
- "items": {
250
- "type": "object",
251
- "properties": {
252
- "name": {"type": "string"},
253
- "nameType": {"$ref": "#/definitions/nameType"},
254
- "givenName": {"type": "string"},
255
- "familyName": {"type": "string"},
256
- "nameIdentifiers": {"$ref": "#/definitions/nameIdentifiers"},
257
- "affiliations": {"$ref": "#/definitions/affiliations"},
258
- "lang": {"type": "string"}
259
- },
260
- "required": ["name"]
261
- },
262
- "minItems": 1,
263
- "uniqueItems": true
264
- },
265
- "titles": {
266
- "type": "array",
267
- "items": {
268
- "type": "object",
269
- "properties": {
270
- "title": {"type": "string"},
271
- "titleType": {"$ref": "#/definitions/titleType"},
272
- "lang": {"type": "string"}
273
- },
274
- "required": ["title"]
275
- },
276
- "minItems": 1,
277
- "uniqueItems": true
278
- },
279
- "publisher": {
280
- "type": "string"
281
- },
282
- "publicationYear": {
283
- "type": "string"
284
- },
285
- "subjects": {
286
- "type": "array",
287
- "items": {
288
- "type": "object",
289
- "properties": {
290
- "subject": {"type": "string"},
291
- "subjectScheme": {"type": "string"},
292
- "schemeURI": {"type": "string", "format": "uri"},
293
- "valueURI": {"type": "string", "format": "uri"},
294
- "lang": {"type": "string"}
295
- },
296
- "required": ["subject"]
297
- },
298
- "uniqueItems": true
299
- },
300
- "contributors": {
301
- "type": "array",
302
- "items": {
303
- "type": "object",
304
- "properties": {
305
- "contributorType": {"$ref": "#/definitions/contributorType"},
306
- "name": {"type": "string"},
307
- "nameType": {"$ref": "#/definitions/nameType"},
308
- "givenName": {"type": "string"},
309
- "familyName": {"type": "string"},
310
- "nameIdentifiers": {"$ref": "#/definitions/nameIdentifiers"},
311
- "affiliations": {"$ref": "#/definitions/affiliations"},
312
- "lang": {"type": "string"}
313
- },
314
- "required": ["contributorType", "name"]
315
- },
316
- "uniqueItems": true
317
- },
318
- "dates": {
319
- "type": "array",
320
- "items": {
321
- "type": "object",
322
- "properties": {
323
- "date": {"$ref": "#/definitions/date"},
324
- "dateType": {"$ref": "#/definitions/dateType"},
325
- "dateInformation": {"type": "string"}
326
- },
327
- "required": ["date", "dateType"]
328
- },
329
- "uniqueItems": true
330
- },
331
- "language": {
332
- "type": "string",
333
- "$comment": "Primary language of the resource. Allowed values are taken from IETF BCP 47, ISO 639-1 language codes."
334
- },
335
- "alternateIdentifiers": {
336
- "type": "array",
337
- "items": {
338
- "type": "object",
339
- "properties": {
340
- "alternateIdentifier": {"type": "string"},
341
- "alternateIdentifierType": {"type": "string"}
342
- },
343
- "required": ["alternateIdentifier", "alternateIdentifierType"]
344
- },
345
- "uniqueItems": true
346
- },
347
- "relatedIdentifiers": {
348
- "type": "array",
349
- "items": {
350
- "type": "object",
351
- "properties": {
352
- "relatedIdentifier": {"type": "string"},
353
- "relatedIdentifierType": {"$ref": "#/definitions/relatedIdentifierType"},
354
- "relationType": {"$ref": "#/definitions/relationType"},
355
- "relatedMetadataScheme": {"type": "string"},
356
- "schemeURI": {"type": "string", "format": "uri"},
357
- "schemeType": {"type": "string"},
358
- "resourceTypeGeneral": {"$ref": "#/definitions/resourceTypeGeneral"}
359
- },
360
- "required": ["relatedIdentifier", "relatedIdentifierType", "relationType"],
361
- "if": {
362
- "properties": {
363
- "relationType": {"enum": ["HasMetadata", "IsMetadataFor"]}
364
- }
365
- },
366
- "else": {
367
- "$comment": "these properties may only be used with relation types HasMetadata/IsMetadataFor",
368
- "properties": {
369
- "relatedMetadataScheme": false,
370
- "schemeURI": false,
371
- "schemeType": false
372
- }
373
- }
374
- },
375
- "uniqueItems": true
376
- },
377
- "sizes": {
378
- "type": "array",
379
- "items": {
380
- "type": "string"
381
- },
382
- "uniqueItems": true
383
- },
384
- "formats": {
385
- "type": "array",
386
- "items": {
387
- "type": "string"
388
- },
389
- "uniqueItems": true
390
- },
391
- "version": {
392
- "type": "string"
393
- },
394
- "rightsList": {
395
- "type": "array",
396
- "items": {
397
- "type": "object",
398
- "properties": {
399
- "rights": {"type": "string"},
400
- "rightsURI": {"type": "string", "format": "uri"},
401
- "rightsIdentifier": {"type": "string"},
402
- "rightsIdentifierScheme": {"type": "string"},
403
- "schemeURI": {"type": "string", "format": "uri"},
404
- "lang": {"type": "string"}
405
- }
406
- },
407
- "uniqueItems": true
408
- },
409
- "descriptions": {
410
- "type": "array",
411
- "items": {
412
- "type": "object",
413
- "properties": {
414
- "description": {"type": "string"},
415
- "descriptionType": {"$ref": "#/definitions/descriptionType"},
416
- "lang": {"type": "string"}
417
- },
418
- "required": ["description", "descriptionType"]
419
- },
420
- "uniqueItems": true
421
- },
422
- "geoLocations": {
423
- "type": "array",
424
- "items": {
425
- "type": "object",
426
- "properties": {
427
- "geoLocationPlace": {"type": "string"},
428
- "geoLocationPoint": {"$ref": "#/definitions/geoLocationPoint"},
429
- "geoLocationBox": {
430
- "type": "object",
431
- "properties": {
432
- "westBoundLongitude": {"$ref": "#/definitions/longitude"},
433
- "eastBoundLongitude": {"$ref": "#/definitions/longitude"},
434
- "southBoundLatitude": {"$ref": "#/definitions/latitude"},
435
- "northBoundLatitude": {"$ref": "#/definitions/latitude"}
436
- },
437
- "required": ["westBoundLongitude", "eastBoundLongitude", "southBoundLatitude", "northBoundLatitude"]
438
- },
439
- "geoLocationPolygons": {
440
- "type": "array",
441
- "items": {
442
- "type": "object",
443
- "properties": {
444
- "polygonPoints": {
445
- "type": "array",
446
- "items": {"$ref": "#/definitions/geoLocationPoint"},
447
- "minItems": 4
448
- },
449
- "inPolygonPoint": {"$ref": "#/definitions/geoLocationPoint"}
450
- },
451
- "required": ["polygonPoints"]
452
- },
453
- "uniqueItems": true
454
- }
455
- }
456
- },
457
- "uniqueItems": true
458
- },
459
- "fundingReferences": {
460
- "type": "array",
461
- "items": {
462
- "type": "object",
463
- "properties": {
464
- "funderName": {"type": "string"},
465
- "funderIdentifier": {"type": "string"},
466
- "funderIdentifierType": {"$ref": "#/definitions/funderIdentifierType"},
467
- "awardNumber": {"type": "string"},
468
- "awardURI": {"type": "string", "format": "uri"},
469
- "awardTitle": {"type": "string"}
470
- },
471
- "required": ["funderName"]
472
- },
473
- "uniqueItems": true
474
- },
475
- "schemaVersion": {
476
- "type": "string",
477
- "const": "http://datacite.org/schema/kernel-4"
478
- },
479
- "xml": {
480
- "type": "string"
481
- }
482
- },
483
- "additionalProperties": false
484
- }
@@ -1,20 +0,0 @@
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