sdr-client 0.90.0 → 0.93.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: 0741b6265694775c1c47bd6ac98cc77d3ffcd9459e2aabfe8c81063f101190a2
4
- data.tar.gz: 4a31a083ebbad99596e02829bbb5429f427dfa28a5f765273d638691352325c3
3
+ metadata.gz: 3465a94659b904cef1659451b8df5c37aafab2603f5d90797ad7b2650e7edc0b
4
+ data.tar.gz: 6a9a8dbf0e1e0087d25a8e73678c6c0eb0eb2cab7a594a0a5592fae6972563e0
5
5
  SHA512:
6
- metadata.gz: 02a6c2b9b9147104c3dcf9d15bbc06839435fc206a38220f3035610ac229ed29c9e0b3742ec4b99539ea8ae7bc452cf011b38ad480c62cee83f825ada80836e1
7
- data.tar.gz: 64de4cbed6b59d12c188d1e8795a31f6c226ea5ff8199701fe53a0976fa7dc43ccc72a393a7768c9e685675859677588b7051a1ec6b144bbb6b3a6efc4c54bf9
6
+ metadata.gz: 9c27c0b7cd9b61ae548e93d086778ec9d94b512ac3f21378f457cc4c651fa9381efba7c3e0b55708e3a2b1333409334ed70c9bcb68168cf2300fa7a8355fc1cf
7
+ data.tar.gz: 50a8908d7d3e445594655612a0b4d0aa28098d03c666c62cb2ff3040a3a9b3912a988e35a97abb91ac0d5ea67d4dbd1b4c82d1f99a357b102b54006c9e1ce1d8
data/.rubocop.yml CHANGED
@@ -14,7 +14,7 @@ Metrics/BlockLength:
14
14
  Exclude:
15
15
  - 'spec/**/*'
16
16
  - 'sdr-client.gemspec'
17
- IgnoredMethods:
17
+ AllowedMethods:
18
18
  - 'OptionParser.new'
19
19
 
20
20
  Metrics/ClassLength:
@@ -175,3 +175,10 @@ RSpec/Capybara/SpecificMatcher: # new in 2.12
175
175
  Enabled: true
176
176
  RSpec/Rails/HaveHttpStatus: # new in 2.12
177
177
  Enabled: true
178
+
179
+ Lint/RequireRangeParentheses: # new in 1.32
180
+ Enabled: true
181
+ Style/EmptyHeredoc: # new in 1.32
182
+ Enabled: true
183
+ Style/MagicCommentFormat: # new in 1.35
184
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
- # on 2022-05-05 05:53:08 UTC using RuboCop version 1.28.2.
3
+ # on 2022-09-08 16:31:29 UTC using RuboCop version 1.36.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -19,7 +19,7 @@ Lint/NoReturnInBeginEndBlocks:
19
19
  - 'lib/sdr_client/deposit/model_process.rb'
20
20
 
21
21
  # Offense count: 2
22
- # This cop supports safe auto-correction (--auto-correct).
22
+ # This cop supports safe autocorrection (--autocorrect).
23
23
  # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
24
24
  Lint/UnusedMethodArgument:
25
25
  Exclude:
@@ -27,20 +27,20 @@ Lint/UnusedMethodArgument:
27
27
  - 'lib/sdr_client/deposit/image_file_set_strategy.rb'
28
28
 
29
29
  # Offense count: 4
30
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
30
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes, Max.
31
31
  Metrics/AbcSize:
32
32
  Exclude:
33
33
  - 'lib/sdr_client/cli.rb'
34
34
  - 'lib/sdr_client/update.rb'
35
35
 
36
36
  # Offense count: 1
37
- # Configuration parameters: IgnoredMethods, Max.
37
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
38
38
  Metrics/CyclomaticComplexity:
39
39
  Exclude:
40
40
  - 'lib/sdr_client/update.rb'
41
41
 
42
42
  # Offense count: 12
43
- # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
43
+ # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
44
44
  Metrics/MethodLength:
45
45
  Exclude:
46
46
  - 'lib/sdr_client/cli.rb'
@@ -59,13 +59,12 @@ RSpec/ExampleLength:
59
59
  - 'spec/sdr_client/model_deposit_spec.rb'
60
60
  - 'spec/sdr_client/update_spec.rb'
61
61
 
62
- # Offense count: 3
62
+ # Offense count: 2
63
63
  # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
64
64
  # Include: **/*_spec*rb*, **/spec/**/*
65
65
  RSpec/FilePath:
66
66
  Exclude:
67
67
  - 'spec/sdr_client/client_spec.rb'
68
- - 'spec/sdr_client/deposit/find_spec.rb'
69
68
  - 'spec/sdr_client/model_deposit_spec.rb'
70
69
 
71
70
  # Offense count: 1
@@ -75,17 +74,18 @@ RSpec/MessageSpies:
75
74
  Exclude:
76
75
  - 'spec/sdr_client/deposit_spec.rb'
77
76
 
78
- # Offense count: 12
77
+ # Offense count: 13
79
78
  # Configuration parameters: Max.
80
79
  RSpec/MultipleExpectations:
81
80
  Exclude:
82
81
  - 'spec/sdr_client/connection_spec.rb'
83
82
  - 'spec/sdr_client/deposit/metadata_builder_spec.rb'
84
83
  - 'spec/sdr_client/deposit_spec.rb'
84
+ - 'spec/sdr_client/find_spec.rb'
85
85
  - 'spec/sdr_client/login_spec.rb'
86
86
  - 'spec/sdr_client/model_deposit_spec.rb'
87
87
 
88
- # Offense count: 32
88
+ # Offense count: 36
89
89
  # Configuration parameters: AllowSubject, Max.
90
90
  RSpec/MultipleMemoizedHelpers:
91
91
  Exclude:
@@ -106,7 +106,7 @@ RSpec/NamedSubject:
106
106
  - 'spec/sdr_client/deposit/process_spec.rb'
107
107
  - 'spec/sdr_client/login_spec.rb'
108
108
 
109
- # Offense count: 16
109
+ # Offense count: 19
110
110
  # Configuration parameters: Max.
111
111
  RSpec/NestedGroups:
112
112
  Exclude:
@@ -117,28 +117,28 @@ RSpec/NestedGroups:
117
117
  - 'spec/sdr_client/update_spec.rb'
118
118
 
119
119
  # Offense count: 19
120
- # This cop supports safe auto-correction (--auto-correct).
120
+ # This cop supports safe autocorrection (--autocorrect).
121
121
  Style/KeywordParametersOrder:
122
122
  Exclude:
123
123
  - 'lib/sdr_client/deposit.rb'
124
124
  - 'lib/sdr_client/deposit/request.rb'
125
125
 
126
126
  # Offense count: 1
127
- # This cop supports safe auto-correction (--auto-correct).
127
+ # This cop supports safe autocorrection (--autocorrect).
128
128
  Style/MultilineTernaryOperator:
129
129
  Exclude:
130
130
  - 'lib/sdr_client/update.rb'
131
131
 
132
132
  # Offense count: 2
133
- # This cop supports unsafe auto-correction (--auto-correct-all).
133
+ # This cop supports unsafe autocorrection (--autocorrect-all).
134
134
  # Configuration parameters: Mode.
135
135
  Style/StringConcatenation:
136
136
  Exclude:
137
137
  - 'lib/sdr_client/deposit/create_resource.rb'
138
138
  - 'spec/sdr_client/deposit_spec.rb'
139
139
 
140
- # Offense count: 29
141
- # This cop supports safe auto-correction (--auto-correct).
140
+ # Offense count: 33
141
+ # This cop supports safe autocorrection (--autocorrect).
142
142
  # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
143
143
  # URISchemes: http, https
144
144
  Layout/LineLength:
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sdr-client (0.90.0)
4
+ sdr-client (0.92.0)
5
5
  activesupport
6
- cocina-models (~> 0.83.0)
6
+ cocina-models (~> 0.84.0)
7
7
  dry-monads
8
8
  faraday (>= 0.16)
9
9
 
@@ -15,12 +15,12 @@ GEM
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
17
17
  tzinfo (~> 2.0)
18
- addressable (2.8.0)
19
- public_suffix (>= 2.0.2, < 5.0)
18
+ addressable (2.8.1)
19
+ public_suffix (>= 2.0.2, < 6.0)
20
20
  ast (2.4.2)
21
21
  attr_extras (6.2.5)
22
22
  byebug (11.1.3)
23
- cocina-models (0.83.0)
23
+ cocina-models (0.84.4)
24
24
  activesupport
25
25
  deprecation
26
26
  dry-struct (~> 1.0)
@@ -43,9 +43,9 @@ GEM
43
43
  activesupport
44
44
  diff-lcs (1.5.0)
45
45
  docile (1.4.0)
46
- dry-container (0.10.0)
46
+ dry-container (0.10.1)
47
47
  concurrent-ruby (~> 1.0)
48
- dry-core (0.8.0)
48
+ dry-core (0.8.1)
49
49
  concurrent-ruby (~> 1.0)
50
50
  dry-inflector (0.3.0)
51
51
  dry-logic (1.2.0)
@@ -68,10 +68,10 @@ GEM
68
68
  activesupport (>= 3.0, < 8.0)
69
69
  equivalent-xml (0.6.0)
70
70
  nokogiri (>= 1.4.3)
71
- faraday (2.3.0)
72
- faraday-net_http (~> 2.0)
71
+ faraday (2.5.2)
72
+ faraday-net_http (>= 2.0, < 3.1)
73
73
  ruby2_keywords (>= 0.0.4)
74
- faraday-net_http (2.0.3)
74
+ faraday-net_http (3.0.0)
75
75
  hashdiff (1.0.1)
76
76
  i18n (1.12.0)
77
77
  concurrent-ruby (~> 1.0)
@@ -79,24 +79,22 @@ GEM
79
79
  json (2.6.2)
80
80
  jsonpath (1.1.2)
81
81
  multi_json
82
- mini_portile2 (2.8.0)
83
- minitest (5.16.2)
82
+ minitest (5.16.3)
84
83
  multi_json (1.15.0)
85
- nokogiri (1.13.6)
86
- mini_portile2 (~> 2.8.0)
84
+ nokogiri (1.13.8-x86_64-darwin)
87
85
  racc (~> 1.4)
88
- nokogiri (1.13.6-x86_64-darwin)
86
+ nokogiri (1.13.8-x86_64-linux)
89
87
  racc (~> 1.4)
90
88
  openapi3_parser (0.9.2)
91
89
  commonmarker (~> 0.17)
92
90
  openapi_parser (0.15.0)
93
91
  optimist (3.0.1)
94
92
  parallel (1.22.1)
95
- parser (3.1.2.0)
93
+ parser (3.1.2.1)
96
94
  ast (~> 2.4.1)
97
95
  patience_diff (1.2.0)
98
96
  optimist (~> 3.0)
99
- public_suffix (4.0.7)
97
+ public_suffix (5.0.0)
100
98
  racc (1.6.0)
101
99
  rainbow (3.1.1)
102
100
  rake (13.0.6)
@@ -119,17 +117,17 @@ GEM
119
117
  rspec-core (>= 2, < 4, != 2.12.0)
120
118
  rss (0.2.9)
121
119
  rexml
122
- rubocop (1.31.2)
120
+ rubocop (1.36.0)
123
121
  json (~> 2.3)
124
122
  parallel (~> 1.10)
125
- parser (>= 3.1.0.0)
123
+ parser (>= 3.1.2.1)
126
124
  rainbow (>= 2.2.2, < 4.0)
127
125
  regexp_parser (>= 1.8, < 3.0)
128
126
  rexml (>= 3.2.5, < 4.0)
129
- rubocop-ast (>= 1.18.0, < 2.0)
127
+ rubocop-ast (>= 1.20.1, < 2.0)
130
128
  ruby-progressbar (~> 1.7)
131
129
  unicode-display_width (>= 1.4.0, < 3.0)
132
- rubocop-ast (1.19.1)
130
+ rubocop-ast (1.21.0)
133
131
  parser (>= 3.1.1.0)
134
132
  rubocop-rake (0.6.0)
135
133
  rubocop (~> 1.0)
@@ -148,16 +146,17 @@ GEM
148
146
  diff-lcs
149
147
  patience_diff
150
148
  thor (1.2.1)
151
- tzinfo (2.0.4)
149
+ tzinfo (2.0.5)
152
150
  concurrent-ruby (~> 1.0)
153
151
  unicode-display_width (2.2.0)
154
- webmock (3.14.0)
152
+ webmock (3.18.1)
155
153
  addressable (>= 2.8.0)
156
154
  crack (>= 0.3.2)
157
155
  hashdiff (>= 0.4.0, < 2.0.0)
158
156
  zeitwerk (2.6.0)
159
157
 
160
158
  PLATFORMS
159
+ x86_64-darwin-19
161
160
  x86_64-darwin-21
162
161
  x86_64-linux
163
162
 
@@ -6,16 +6,18 @@ module SdrClient
6
6
  class UpdateResource
7
7
  DRO_PATH = '/v1/resources/%<id>s'
8
8
 
9
- def self.run(metadata:, logger:, connection:)
10
- new(metadata: metadata, logger: logger, connection: connection).run
9
+ def self.run(metadata:, logger:, connection:, version_description: nil)
10
+ new(metadata: metadata, logger: logger, connection: connection, version_description: version_description).run
11
11
  end
12
12
 
13
13
  # @param [Cocina::Models::DRO] metadata
14
14
  # @param [Hash<Symbol,String>] the result of the metadata call
15
- def initialize(metadata:, logger:, connection:)
15
+ # @param [String] version_description
16
+ def initialize(metadata:, logger:, connection:, version_description: nil)
16
17
  @metadata = metadata
17
18
  @logger = logger
18
19
  @connection = connection
20
+ @version_description = version_description
19
21
  end
20
22
 
21
23
  # @param [Hash<Symbol,String>] the result of the metadata call
@@ -31,7 +33,7 @@ module SdrClient
31
33
 
32
34
  private
33
35
 
34
- attr_reader :metadata, :logger, :connection
36
+ attr_reader :metadata, :logger, :connection, :version_description
35
37
 
36
38
  def metadata_request
37
39
  json = metadata.to_json
@@ -39,7 +41,9 @@ module SdrClient
39
41
 
40
42
  connection.put(path(metadata), json,
41
43
  'Content-Type' => 'application/json',
42
- 'X-Cocina-Models-Version' => Cocina::Models::VERSION)
44
+ 'X-Cocina-Models-Version' => Cocina::Models::VERSION) do |req|
45
+ req.params['versionDescription'] = version_description if version_description
46
+ end
43
47
  end
44
48
 
45
49
  def path(metadata)
@@ -6,6 +6,11 @@ module SdrClient
6
6
  # The namespace for the "get" command
7
7
  module Find
8
8
  DRO_PATH = '/v1/resources/%<id>s'
9
+
10
+ # Raised when find returns an unsuccessful response
11
+ class Failed < StandardError; end
12
+
13
+ # @raise [Failed] if the find operation fails
9
14
  # @return [String] JSON for the given Cocina object or an error
10
15
  def self.run(druid, url:, logger: Logger.new($stdout))
11
16
  connection = Connection.new(url: url)
@@ -13,7 +18,9 @@ module SdrClient
13
18
  logger.info("Retrieving metadata from: #{path}")
14
19
  response = connection.get(path)
15
20
  unless response.success?
16
- logger.error("There was an HTTP #{response.status} error making the request: #{response.body}")
21
+ error_message = "There was an HTTP #{response.status} error making the request: #{response.body}"
22
+ logger.error(error_message)
23
+ raise Failed, error_message
17
24
  end
18
25
  response.body
19
26
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SdrClient
4
- VERSION = '0.90.0'
4
+ VERSION = '0.93.0'
5
5
  end
data/sdr-client.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_dependency 'activesupport'
31
- spec.add_dependency 'cocina-models', '~> 0.83.0'
31
+ spec.add_dependency 'cocina-models', '~> 0.84.0'
32
32
  spec.add_dependency 'dry-monads'
33
33
  spec.add_dependency 'faraday', '>= 0.16'
34
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdr-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.90.0
4
+ version: 0.93.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-18 00:00:00.000000000 Z
11
+ date: 2022-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.83.0
33
+ version: 0.84.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.83.0
40
+ version: 0.84.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-monads
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -259,7 +259,7 @@ metadata:
259
259
  source_code_uri: https://github.com/sul-dlss/sdr-client
260
260
  changelog_uri: https://github.com/sul-dlss/sdr-client/releases
261
261
  rubygems_mfa_required: 'true'
262
- post_install_message:
262
+ post_install_message:
263
263
  rdoc_options: []
264
264
  require_paths:
265
265
  - lib
@@ -274,8 +274,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  - !ruby/object:Gem::Version
275
275
  version: '0'
276
276
  requirements: []
277
- rubygems_version: 3.3.7
278
- signing_key:
277
+ rubygems_version: 3.2.32
278
+ signing_key:
279
279
  specification_version: 4
280
280
  summary: The CLI for https://github.com/sul-dlss/sdr-api
281
281
  test_files: []