datacite 0.4.0 → 0.5.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: 8c402c810fe15ec361ab43cc1d16eb828cf20996453c0c1ef6ebe9c37a843eb3
4
- data.tar.gz: 77b49fcbb192cf95d5ede1eb4718fa1fa200c57b4a40f2780e19052bbdd96e09
3
+ metadata.gz: 14e944d80dc95aa79554d485193762732d942e6b17cc039cbd88bd2a390b9289
4
+ data.tar.gz: 7358ac61628a052e33c3bd82da253451135e87a9e584695b28022d33801ae0df
5
5
  SHA512:
6
- metadata.gz: f6cbae355c732c44531a9b5b8378ede3daf2616b86b473a3355d548b572306f7860a4c697ab6dcf74b380aaf677e06dc2748c16a98bd0bebf840e2ca9bb254de
7
- data.tar.gz: 955cbd7fdcf0ff420c255070a7586c333b14e1960defd74140f2650228d7f6654a542e21d87629be3dc8a8f8966904e39622498052e9d725c05d1e97b5012b65
6
+ metadata.gz: 6fd39012378ac1312ae25e38ac72797f58daec08db118b94548f898be989d5ef2a2dcf6e55d1a513333bc73ca21beeea32cf92387c312c6f1eb29cc906afb942
7
+ data.tar.gz: 3efbef3e7d82b69ba1b2c5df6c2b9423b0a618c10e41dba770e5102581fa5f4b75fa12b552b280de011d126211bab4cc89e343c6ce7c32f4a2704b2ed43c019d
@@ -0,0 +1,11 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby-rails: sul-dlss/ruby-rails@4.6.0
4
+ workflows:
5
+ build:
6
+ jobs:
7
+ - ruby-rails/lint:
8
+ name: lint
9
+ - ruby-rails/test-gem:
10
+ name: test
11
+ context: dlss
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-rake
3
3
  - rubocop-rspec
4
4
 
@@ -227,40 +227,6 @@ Style/SwapValues: # new in 1.1
227
227
  Enabled: true
228
228
  Style/YAMLFileRead: # new in 1.53
229
229
  Enabled: true
230
- Capybara/ClickLinkOrButtonStyle: # new in 2.19
231
- Enabled: true
232
- Capybara/MatchStyle: # new in 2.17
233
- Enabled: true
234
- Capybara/NegationMatcher: # new in 2.14
235
- Enabled: true
236
- Capybara/RedundantWithinFind: # new in 2.20
237
- Enabled: true
238
- Capybara/SpecificActions: # new in 2.14
239
- Enabled: true
240
- Capybara/SpecificFinders: # new in 2.13
241
- Enabled: true
242
- Capybara/SpecificMatcher: # new in 2.12
243
- Enabled: true
244
- Capybara/RSpec/HaveSelector: # new in 2.19
245
- Enabled: true
246
- Capybara/RSpec/PredicateMatcher: # new in 2.19
247
- Enabled: true
248
- FactoryBot/AssociationStyle: # new in 2.23
249
- Enabled: true
250
- FactoryBot/ConsistentParenthesesStyle: # new in 2.14
251
- Enabled: true
252
- FactoryBot/ExcessiveCreateList: # new in 2.25
253
- Enabled: true
254
- FactoryBot/FactoryAssociationWithStrategy: # new in 2.23
255
- Enabled: true
256
- FactoryBot/FactoryNameStyle: # new in 2.16
257
- Enabled: true
258
- FactoryBot/IdSequence: # new in 2.24
259
- Enabled: true
260
- FactoryBot/RedundantFactoryOption: # new in 2.23
261
- Enabled: true
262
- FactoryBot/SyntaxMethods: # new in 2.7
263
- Enabled: true
264
230
  RSpec/BeEmpty: # new in 2.20
265
231
  Enabled: true
266
232
  RSpec/BeEq: # new in 2.9.0
@@ -311,15 +277,61 @@ RSpec/SubjectDeclaration: # new in 2.5
311
277
  Enabled: true
312
278
  RSpec/VerifiedDoubleReference: # new in 2.10.0
313
279
  Enabled: true
314
- RSpec/Rails/AvoidSetupHook: # new in 2.4
280
+ Gemspec/AddRuntimeDependency: # new in 1.65
281
+ Enabled: true
282
+ Lint/ArrayLiteralInRegexp: # new in 1.71
283
+ Enabled: true
284
+ Lint/ConstantReassignment: # new in 1.70
285
+ Enabled: true
286
+ Lint/CopDirectiveSyntax: # new in 1.72
287
+ Enabled: true
288
+ Lint/DuplicateSetElement: # new in 1.67
289
+ Enabled: true
290
+ Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
291
+ Enabled: true
292
+ Lint/NumericOperationWithConstantResult: # new in 1.69
293
+ Enabled: true
294
+ Lint/RedundantTypeConversion: # new in 1.72
295
+ Enabled: true
296
+ Lint/SharedMutableDefault: # new in 1.70
297
+ Enabled: true
298
+ Lint/SuppressedExceptionInNumberConversion: # new in 1.72
299
+ Enabled: true
300
+ Lint/UnescapedBracketInRegexp: # new in 1.68
301
+ Enabled: true
302
+ Lint/UselessConstantScoping: # new in 1.72
303
+ Enabled: true
304
+ Lint/UselessDefined: # new in 1.69
305
+ Enabled: true
306
+ Lint/UselessNumericOperation: # new in 1.66
307
+ Enabled: true
308
+ Style/AmbiguousEndlessMethodDefinition: # new in 1.68
309
+ Enabled: true
310
+ Style/BitwisePredicate: # new in 1.68
311
+ Enabled: true
312
+ Style/CombinableDefined: # new in 1.68
313
+ Enabled: true
314
+ Style/DigChain: # new in 1.69
315
+ Enabled: true
316
+ Style/FileNull: # new in 1.69
317
+ Enabled: true
318
+ Style/FileTouch: # new in 1.69
319
+ Enabled: true
320
+ Style/HashSlice: # new in 1.71
321
+ Enabled: true
322
+ Style/ItAssignment: # new in 1.70
323
+ Enabled: true
324
+ Style/KeywordArgumentsMerging: # new in 1.68
325
+ Enabled: true
326
+ Style/MapIntoArray: # new in 1.63
315
327
  Enabled: true
316
- RSpec/Rails/HaveHttpStatus: # new in 2.12
328
+ Style/RedundantFormat: # new in 1.72
317
329
  Enabled: true
318
- RSpec/Rails/InferredSpecType: # new in 2.14
330
+ Style/RedundantInterpolationUnfreeze: # new in 1.66
319
331
  Enabled: true
320
- RSpec/Rails/MinitestAssertions: # new in 2.17
332
+ Style/SafeNavigationChainLength: # new in 1.68
321
333
  Enabled: true
322
- RSpec/Rails/NegationBeValid: # new in 2.23
334
+ Style/SendWithLiteralMethodName: # new in 1.64
323
335
  Enabled: true
324
- RSpec/Rails/TravelAround: # new in 2.19
336
+ Style/SuperArguments: # new in 1.64
325
337
  Enabled: true
data/Gemfile CHANGED
@@ -11,6 +11,7 @@ gem "byebug"
11
11
  gem "rake", "~> 13.0"
12
12
  gem "rspec", "~> 3.0"
13
13
  gem "rubocop", "~> 1.7"
14
- gem "rubocop-rake", "~> 0.6.0"
15
- gem "rubocop-rspec", "~> 2.4"
14
+ gem "rubocop-rake"
15
+ gem "rubocop-rspec"
16
+ gem "simplecov"
16
17
  gem "webmock", "~> 3.13"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- datacite (0.4.0)
4
+ datacite (0.5.0)
5
5
  dry-monads (~> 1.3)
6
6
  faraday (~> 2.0)
7
7
  json_schema (~> 0.21.0)
@@ -12,51 +12,54 @@ GEM
12
12
  specs:
13
13
  addressable (2.8.7)
14
14
  public_suffix (>= 2.0.2, < 7.0)
15
- ast (2.4.2)
15
+ ast (2.4.3)
16
16
  base64 (0.2.0)
17
17
  bigdecimal (3.1.9)
18
- byebug (11.1.3)
19
- concurrent-ruby (1.3.4)
18
+ byebug (12.0.0)
19
+ concurrent-ruby (1.3.5)
20
20
  crack (1.0.0)
21
21
  bigdecimal
22
22
  rexml
23
- diff-lcs (1.5.1)
23
+ diff-lcs (1.6.1)
24
+ docile (1.4.1)
24
25
  dry-core (1.1.0)
25
26
  concurrent-ruby (~> 1.0)
26
27
  logger
27
28
  zeitwerk (~> 2.6)
28
- dry-monads (1.7.0)
29
+ dry-monads (1.8.3)
29
30
  concurrent-ruby (~> 1.0)
30
31
  dry-core (~> 1.1)
31
32
  zeitwerk (~> 2.6)
32
- faraday (2.12.2)
33
+ faraday (2.13.1)
33
34
  faraday-net_http (>= 2.0, < 3.5)
34
35
  json
35
36
  logger
36
37
  faraday-net_http (3.4.0)
37
38
  net-http (>= 0.5.0)
38
39
  hashdiff (1.1.2)
39
- json (2.9.1)
40
+ json (2.11.3)
40
41
  json_schema (0.21.0)
41
- language_server-protocol (3.17.0.3)
42
- logger (1.6.5)
42
+ language_server-protocol (3.17.0.4)
43
+ lint_roller (1.1.0)
44
+ logger (1.7.0)
43
45
  net-http (0.6.0)
44
46
  uri
45
- parallel (1.26.3)
46
- parser (3.3.6.0)
47
+ parallel (1.27.0)
48
+ parser (3.3.8.0)
47
49
  ast (~> 2.4.1)
48
50
  racc
51
+ prism (1.4.0)
49
52
  public_suffix (6.0.1)
50
53
  racc (1.8.1)
51
54
  rainbow (3.1.1)
52
55
  rake (13.2.1)
53
56
  regexp_parser (2.10.0)
54
- rexml (3.4.0)
57
+ rexml (3.4.1)
55
58
  rspec (3.13.0)
56
59
  rspec-core (~> 3.13.0)
57
60
  rspec-expectations (~> 3.13.0)
58
61
  rspec-mocks (~> 3.13.0)
59
- rspec-core (3.13.2)
62
+ rspec-core (3.13.3)
60
63
  rspec-support (~> 3.13.0)
61
64
  rspec-expectations (3.13.3)
62
65
  diff-lcs (>= 1.2.0, < 2.0)
@@ -65,41 +68,42 @@ GEM
65
68
  diff-lcs (>= 1.2.0, < 2.0)
66
69
  rspec-support (~> 3.13.0)
67
70
  rspec-support (3.13.2)
68
- rubocop (1.70.0)
71
+ rubocop (1.75.3)
69
72
  json (~> 2.3)
70
- language_server-protocol (>= 3.17.0)
73
+ language_server-protocol (~> 3.17.0.2)
74
+ lint_roller (~> 1.1.0)
71
75
  parallel (~> 1.10)
72
76
  parser (>= 3.3.0.2)
73
77
  rainbow (>= 2.2.2, < 4.0)
74
78
  regexp_parser (>= 2.9.3, < 3.0)
75
- rubocop-ast (>= 1.36.2, < 2.0)
79
+ rubocop-ast (>= 1.44.0, < 2.0)
76
80
  ruby-progressbar (~> 1.7)
77
81
  unicode-display_width (>= 2.4.0, < 4.0)
78
- rubocop-ast (1.37.0)
79
- parser (>= 3.3.1.0)
80
- rubocop-capybara (2.21.0)
81
- rubocop (~> 1.41)
82
- rubocop-factory_bot (2.26.1)
83
- rubocop (~> 1.61)
84
- rubocop-rake (0.6.0)
85
- rubocop (~> 1.0)
86
- rubocop-rspec (2.31.0)
87
- rubocop (~> 1.40)
88
- rubocop-capybara (~> 2.17)
89
- rubocop-factory_bot (~> 2.22)
90
- rubocop-rspec_rails (~> 2.28)
91
- rubocop-rspec_rails (2.29.1)
92
- rubocop (~> 1.61)
82
+ rubocop-ast (1.44.1)
83
+ parser (>= 3.3.7.2)
84
+ prism (~> 1.4)
85
+ rubocop-rake (0.7.1)
86
+ lint_roller (~> 1.1)
87
+ rubocop (>= 1.72.1)
88
+ rubocop-rspec (3.6.0)
89
+ lint_roller (~> 1.1)
90
+ rubocop (~> 1.72, >= 1.72.1)
93
91
  ruby-progressbar (1.13.0)
94
- unicode-display_width (3.1.3)
92
+ simplecov (0.22.0)
93
+ docile (~> 1.1)
94
+ simplecov-html (~> 0.11)
95
+ simplecov_json_formatter (~> 0.1)
96
+ simplecov-html (0.13.1)
97
+ simplecov_json_formatter (0.1.4)
98
+ unicode-display_width (3.1.4)
95
99
  unicode-emoji (~> 4.0, >= 4.0.4)
96
100
  unicode-emoji (4.0.4)
97
- uri (1.0.2)
98
- webmock (3.24.0)
101
+ uri (1.0.3)
102
+ webmock (3.25.1)
99
103
  addressable (>= 2.8.0)
100
104
  crack (>= 0.3.2)
101
105
  hashdiff (>= 0.4.0, < 2.0.0)
102
- zeitwerk (2.7.1)
106
+ zeitwerk (2.7.2)
103
107
 
104
108
  PLATFORMS
105
109
  arm64-darwin-23
@@ -116,9 +120,10 @@ DEPENDENCIES
116
120
  rake (~> 13.0)
117
121
  rspec (~> 3.0)
118
122
  rubocop (~> 1.7)
119
- rubocop-rake (~> 0.6.0)
120
- rubocop-rspec (~> 2.4)
123
+ rubocop-rake
124
+ rubocop-rspec
125
+ simplecov
121
126
  webmock (~> 3.13)
122
127
 
123
128
  BUNDLED WITH
124
- 2.4.13
129
+ 2.6.8
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
- # Datacite Ruby Client
2
-
3
1
  [![Gem Version](https://badge.fury.io/rb/datacite.svg)](https://badge.fury.io/rb/datacite)
2
+ [![CircleCI](https://circleci.com/gh/sul-dlss/datacite-ruby.svg?style=svg)](https://circleci.com/gh/sul-dlss/datacite-ruby)
3
+ [![codecov](https://codecov.io/github/sul-dlss/datacite-ruby/graph/badge.svg?token=1FGARREHJN)](https://codecov.io/github/sul-dlss/datacite-ruby)
4
+
5
+ # Datacite Ruby Client
4
6
 
5
7
  This is a Ruby client for interfacing with the DataCite REST API. https://support.datacite.org/docs/api
6
8
 
@@ -35,7 +37,7 @@ client = Datacite::Client.new(username: "foo",
35
37
  result = client.register_doi(prefix: '10.0001', suffix: 'bc123df4567')
36
38
 
37
39
  result.either(
38
- -> response { response.doi },
40
+ -> response { response },
39
41
  -> response { raise("Something went wrong", response.status) }
40
42
  )
41
43
  ```
@@ -82,7 +84,18 @@ result.either(
82
84
  -> response { response },
83
85
  -> response { raise("Something went wrong", response.status) }
84
86
  )
87
+ ```
88
+
89
+ ### Get metadata for a DOI
85
90
 
91
+ ```ruby
92
+ result = client.metadata(id: '10.0001/bc123df4567')
93
+
94
+ result.either(
95
+ -> response { response },
96
+ -> response { raise("Something went wrong", response.status) }
97
+ )
98
+ ```
86
99
 
87
100
  ### Validation
88
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
@@ -71,6 +71,18 @@ module Datacite
71
71
  end
72
72
  end
73
73
 
74
+ # Fetches the metadata for a DOI
75
+ # @param [String] id
76
+ # @returns [Dry::Monads::Result(Hash)]
77
+ def metadata(id:)
78
+ response = conn.get("/dois/#{id}")
79
+ if response.success?
80
+ Success(response.body)
81
+ else
82
+ Failure(response)
83
+ end
84
+ end
85
+
74
86
  private
75
87
 
76
88
  # @returns [Dry::Monads::Result]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Datacite
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.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.4.0
4
+ version: 0.5.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: 2025-01-14 00:00:00.000000000 Z
11
+ date: 2025-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -73,8 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
+ - ".circleci/config.yml"
76
77
  - ".github/pull_request_template.md"
77
- - ".github/workflows/main.yml"
78
78
  - ".gitignore"
79
79
  - ".rspec"
80
80
  - ".rubocop.yml"
@@ -1,16 +0,0 @@
1
- name: Ruby
2
-
3
- on: [push,pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/checkout@v3
10
- - name: Set up Ruby
11
- uses: ruby/setup-ruby@v1
12
- with:
13
- ruby-version: 3.0
14
- bundler-cache: true
15
- - name: Run the default task
16
- run: bundle exec rake