dor-services-client 7.5.0 → 7.6.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: 102f50b5badab7e35c9439e1cfa90893bfc8fa6107ea76bad54faa69b4750ad3
4
- data.tar.gz: 8a08395f1160f4995709c5876447b3da93f5d65c2b4f288824f94c5acb56496e
3
+ metadata.gz: 8e2d9e5cd1569dfa3cb099d27fb999c5fda7434db1fa07de5db64ff728bc00ec
4
+ data.tar.gz: 221f79c403afb4daba61e4d21f8d9d8f2c59ac2ee192bd0c9739922cb9060d47
5
5
  SHA512:
6
- metadata.gz: 6544010edbe3d761f8a2a2e75d2a62e8430d8fcbf073984ceb0ea754bab6817560170cacf9892a4820fd7839edcddce4652bbc633afe23f3ec6f4f251862c255
7
- data.tar.gz: 2a8aca578dc0fa8181cd12325a84bdf791a237bed1d6d793a5d03eb513ad3d16d6816a68337ab4105d91e182e1bffb83b37f58a2898a01c886efb734c5284a00
6
+ metadata.gz: 1689a1120fd0c7454b1905d9b64b4abee90f7cf61b7c03df4b13227ea93eb1ed30a8c07bab9202b07f7f4fc0bd1e73e280e096e8e42b7246e2973cd73b7c07f3
7
+ data.tar.gz: aba6793400aad63490bdee7a1e25d238ddcf5d4b4ae7c2e652f3f62abe05c78e9c28760a4daae3e88e0bdde782dbb5d9a90828c478231875763882ee7bfe77c3
data/.circleci/config.yml CHANGED
@@ -1,35 +1,10 @@
1
1
  version: 2.1
2
-
3
- jobs:
2
+ orbs:
3
+ ruby-rails: sul-dlss/ruby-rails@2.0.0
4
+ workflows:
4
5
  build:
5
- docker:
6
- - image: cimg/ruby:3.0
7
- environment:
8
- CC_TEST_REPORTER_ID: 47b57fbbf65654b17f33b6ff4a108ce2abed31a86468033f20eb4d4e9e09935a
9
- RAILS_ENV: test
10
- steps:
11
- - checkout
12
- - run:
13
- name: Install Bundler
14
- command: gem install bundler
15
- - run:
16
- name: Which bundler?
17
- command: bundle -v
18
- - run:
19
- name: Bundle Install
20
- command: bundle check || bundle install
21
- - run:
22
- name: Lint using rubocop
23
- command: bundle exec rubocop
24
- - run:
25
- name: Setup Code Climate test-reporter
26
- command: |
27
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
28
- chmod +x ./cc-test-reporter
29
- ./cc-test-reporter before-build
30
- - run:
31
- name: rspec
32
- command: bundle exec rspec
33
- - run:
34
- name: upload test coverage report to Code Climate
35
- command: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
6
+ jobs:
7
+ - ruby-rails/lint:
8
+ name: lint
9
+ - ruby-rails/test-gem:
10
+ name: test
data/.rubocop.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
+ require:
4
+ - rubocop-rspec
5
+
3
6
  AllCops:
4
- TargetRubyVersion: 2.6
7
+ TargetRubyVersion: 2.7 # dor-services-app can't be 3 due to fedora3
5
8
  SuggestExtensions: false
6
9
 
7
10
  Metrics/BlockLength:
@@ -81,3 +84,47 @@ Layout/LineEndStringConcatenationIndentation: # (new in 1.18)
81
84
  Enabled: true
82
85
  Naming/InclusiveLanguage: # (new in 1.18)
83
86
  Enabled: true
87
+
88
+ Gemspec/RequireMFA: # new in 1.23
89
+ Enabled: true
90
+ Lint/AmbiguousOperatorPrecedence: # new in 1.21
91
+ Enabled: true
92
+ Lint/AmbiguousRange: # new in 1.19
93
+ Enabled: true
94
+ Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
95
+ Enabled: true
96
+ Lint/RequireRelativeSelfPath: # new in 1.22
97
+ Enabled: true
98
+ Lint/UselessRuby2Keywords: # new in 1.23
99
+ Enabled: true
100
+ Naming/BlockForwarding: # new in 1.24
101
+ Enabled: true
102
+ Security/IoMethods: # new in 1.22
103
+ Enabled: true
104
+ Style/FileRead: # new in 1.24
105
+ Enabled: true
106
+ Style/FileWrite: # new in 1.24
107
+ Enabled: true
108
+ Style/MapToHash: # new in 1.24
109
+ Enabled: true
110
+ Style/NumberedParameters: # new in 1.22
111
+ Enabled: true
112
+ Style/NumberedParametersLimit: # new in 1.22
113
+ Enabled: true
114
+ Style/OpenStructUse: # new in 1.23
115
+ Enabled: true
116
+ Style/RedundantSelfAssignmentBranch: # new in 1.19
117
+ Enabled: true
118
+ Style/SelectByRegexp: # new in 1.22
119
+ Enabled: true
120
+
121
+ RSpec/ExcessiveDocstringSpacing: # new in 2.5
122
+ Enabled: true
123
+ RSpec/IdenticalEqualityAssertion: # new in 2.4
124
+ Enabled: true
125
+ RSpec/SubjectDeclaration: # new in 2.5
126
+ Enabled: true
127
+ RSpec/FactoryBot/SyntaxMethods: # new in 2.7
128
+ Enabled: true
129
+ RSpec/Rails/AvoidSetupHook: # new in 2.4
130
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,22 +1,86 @@
1
1
  # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2021-03-17 17:24:07 UTC using RuboCop version 1.11.0.
2
+ # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
+ # on 2022-01-14 01:12:44 UTC using RuboCop version 1.24.1.
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
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 2
10
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
10
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
11
11
  Metrics/AbcSize:
12
- Max: 22
12
+ Exclude:
13
+ - 'lib/dor/services/client/marcxml.rb'
13
14
 
14
15
  # Offense count: 1
15
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
16
+ # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
16
17
  Metrics/MethodLength:
17
- Max: 11
18
+ Exclude:
19
+ - 'lib/dor/services/client/transfer.rb'
20
+
21
+ # Offense count: 4
22
+ RSpec/AnyInstance:
23
+ Exclude:
24
+ - 'spec/dor/services/client/async_result_spec.rb'
25
+ - 'spec/dor/services/client/metadata_spec.rb'
26
+ - 'spec/dor/services/client/object_version_spec.rb'
27
+
28
+ # Offense count: 1
29
+ # Configuration parameters: Max, CountAsOne.
30
+ RSpec/ExampleLength:
31
+ Exclude:
32
+ - 'spec/dor/services/client/metadata_spec.rb'
33
+
34
+ # Offense count: 6
35
+ RSpec/IdenticalEqualityAssertion:
36
+ Exclude:
37
+ - 'spec/dor/services/client_spec.rb'
38
+
39
+ # Offense count: 8
40
+ # Configuration parameters: Max.
41
+ RSpec/MultipleExpectations:
42
+ Exclude:
43
+ - 'spec/dor/services/client/async_result_spec.rb'
44
+ - 'spec/dor/services/client/background_job_results_spec.rb'
45
+ - 'spec/dor/services/client/events_spec.rb'
46
+ - 'spec/dor/services/client/object_spec.rb'
47
+ - 'spec/dor/services/client/response_error_formatter_spec.rb'
48
+
49
+ # Offense count: 7
50
+ # Configuration parameters: AllowSubject, Max.
51
+ RSpec/MultipleMemoizedHelpers:
52
+ Exclude:
53
+ - 'spec/dor/services/client/objects_spec.rb'
54
+
55
+ # Offense count: 1
56
+ # Cop supports --auto-correct.
57
+ RSpec/MultipleSubjects:
58
+ Exclude:
59
+ - 'spec/dor/services/client/object_spec.rb'
60
+
61
+ # Offense count: 13
62
+ # Configuration parameters: Max.
63
+ RSpec/NestedGroups:
64
+ Exclude:
65
+ - 'spec/dor/services/client/accession_spec.rb'
66
+ - 'spec/dor/services/client/background_job_results_spec.rb'
67
+ - 'spec/dor/services/client/metadata_spec.rb'
68
+ - 'spec/dor/services/client/objects_spec.rb'
69
+ - 'spec/dor/services/client_spec.rb'
70
+
71
+ # Offense count: 4
72
+ RSpec/RepeatedDescription:
73
+ Exclude:
74
+ - 'spec/dor/services/client/object_spec.rb'
75
+
76
+ # Offense count: 3
77
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
78
+ RSpec/VerifiedDoubles:
79
+ Exclude:
80
+ - 'spec/dor/services/client/response_error_formatter_spec.rb'
18
81
 
19
82
  # Offense count: 1
83
+ # Configuration parameters: AllowedConstants.
20
84
  Style/Documentation:
21
85
  Exclude:
22
86
  - 'spec/**/*'
@@ -25,7 +89,7 @@ Style/Documentation:
25
89
 
26
90
  # Offense count: 77
27
91
  # Cop supports --auto-correct.
28
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
92
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
29
93
  # URISchemes: http, https
30
94
  Layout/LineLength:
31
95
  Max: 164
data/README.md CHANGED
@@ -96,6 +96,9 @@ object_client.update(params: dro)
96
96
  # Publish an object (push to PURL)
97
97
  object_client.publish(workflow: 'releaseWF', lane_id: 'low')
98
98
 
99
+ # Unpublish an object (yank from PURL)
100
+ object_client.unpublish()
101
+
99
102
  # Shelve an object (push to Stacks)
100
103
  object_client.shelve(lane_id: 'low')
101
104
 
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.required_ruby_version = '>= 2.6', '< 4'
25
+ spec.required_ruby_version = '>= 2.7', '< 4' # dor-services-app needs 2.7 due to fedora3
26
26
 
27
27
  spec.add_dependency 'activesupport', '>= 4.2', '< 8'
28
28
  spec.add_dependency 'cocina-models', '~> 0.62.0' # leave pinned to patch level until cocina-models hits 1.0
@@ -35,6 +35,8 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency 'rake', '>= 12.3.3'
36
36
  spec.add_development_dependency 'rspec', '~> 3.0'
37
37
  spec.add_development_dependency 'rubocop', '~> 1.0'
38
- spec.add_development_dependency 'simplecov', '~> 0.17.0' # CodeClimate cannot use SimpleCov >= 0.18.0 for generating test coverage
38
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
39
+ spec.add_development_dependency 'simplecov'
39
40
  spec.add_development_dependency 'webmock'
41
+ spec.metadata['rubygems_mfa_required'] = 'true'
40
42
  end
@@ -83,7 +83,7 @@ module Dor
83
83
  Transfer.new(**parent_params)
84
84
  end
85
85
 
86
- delegate :publish, :preserve, :shelve, to: :transfer
86
+ delegate :publish, :unpublish, :preserve, :shelve, to: :transfer
87
87
 
88
88
  def mutate
89
89
  Mutate.new(**parent_params)
@@ -14,9 +14,9 @@ module Dor
14
14
  # Publish an object (send to PURL)
15
15
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
16
16
  # @raise [UnexpectedResponse] when the response is not successful.
17
- # @param [String] workflow ('accessionWF') which workflow to callback to.
17
+ # @param [String] workflow (nil) which workflow to callback to.
18
18
  # @param [String] lane_id for prioritization (default or low)
19
- # @return [boolean] true on success
19
+ # @return [String] the URL of the background job on dor-service-app
20
20
  def publish(workflow: nil, lane_id: nil)
21
21
  query_params = [].tap do |params|
22
22
  params << "workflow=#{workflow}" if workflow
@@ -32,6 +32,19 @@ module Dor
32
32
  raise_exception_based_on_response!(resp)
33
33
  end
34
34
 
35
+ # Unpublish an object (yank from to PURL)
36
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
37
+ # @raise [UnexpectedResponse] when the response is not successful.
38
+ # @return [String] the URL of the background job on dor-service-app
39
+ def unpublish
40
+ resp = connection.post do |req|
41
+ req.url "#{object_path}/unpublish"
42
+ end
43
+ return resp.headers['Location'] if resp.success?
44
+
45
+ raise_exception_based_on_response!(resp)
46
+ end
47
+
35
48
  # Preserve an object (send to SDR)
36
49
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
37
50
  # @raise [UnexpectedResponse] when the response is not successful.
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '7.5.0'
6
+ VERSION = '7.6.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.5.0
4
+ version: 7.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-01-04 00:00:00.000000000 Z
12
+ date: 2022-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -164,19 +164,33 @@ dependencies:
164
164
  - !ruby/object:Gem::Version
165
165
  version: '1.0'
166
166
  - !ruby/object:Gem::Dependency
167
- name: simplecov
167
+ name: rubocop-rspec
168
168
  requirement: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: 0.17.0
172
+ version: '2.1'
173
173
  type: :development
174
174
  prerelease: false
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 0.17.0
179
+ version: '2.1'
180
+ - !ruby/object:Gem::Dependency
181
+ name: simplecov
182
+ requirement: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ type: :development
188
+ prerelease: false
189
+ version_requirements: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
180
194
  - !ruby/object:Gem::Dependency
181
195
  name: webmock
182
196
  requirement: !ruby/object:Gem::Requirement
@@ -237,7 +251,8 @@ files:
237
251
  - lib/dor/services/client/workspace.rb
238
252
  homepage: https://github.com/sul-dlss/dor-services-client
239
253
  licenses: []
240
- metadata: {}
254
+ metadata:
255
+ rubygems_mfa_required: 'true'
241
256
  post_install_message:
242
257
  rdoc_options: []
243
258
  require_paths:
@@ -246,7 +261,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
246
261
  requirements:
247
262
  - - ">="
248
263
  - !ruby/object:Gem::Version
249
- version: '2.6'
264
+ version: '2.7'
250
265
  - - "<"
251
266
  - !ruby/object:Gem::Version
252
267
  version: '4'
@@ -256,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
271
  - !ruby/object:Gem::Version
257
272
  version: '0'
258
273
  requirements: []
259
- rubygems_version: 3.1.4
274
+ rubygems_version: 3.2.32
260
275
  signing_key:
261
276
  specification_version: 4
262
277
  summary: A client for dor-services-app