dor-workflow-client 3.13.0 → 3.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +7 -3
- data/.travis.yml +0 -1
- data/lib/dor/workflow/client/version.rb +1 -1
- data/lib/dor/workflow/client/version_routes.rb +24 -2
- data/spec/workflow/client_spec.rb +30 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a00ebf82eddf3b2cce94a9e1eb3d4eeb77e78fb7280131b5f8cd475e611ff1c
|
4
|
+
data.tar.gz: fb8e8d16cebc1436e6747c5e601227c786ed007e54507f154dd3c248694f4fa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 118a58574b972bd2c235103fcf71edc582a3e841c4641506a658881819a7a005ea356b3fef233d7733363cc83f35a3697a0c3ac783ef5d6d0d5e546a9336b29f
|
7
|
+
data.tar.gz: a4721adc49f0130683b82cad84cc487a5e33f206a814151381a6c75448661472b6bda149473d382908c7c8093e636ffb44382b44bfa1e66d5d1b7fd0248133bb
|
data/.rubocop_todo.yml
CHANGED
@@ -1,14 +1,18 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2020-01-06 12:37:25 -0600 using RuboCop version 0.63.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
|
-
# Offense count:
|
9
|
+
# Offense count: 4
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 26
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
Metrics/CyclomaticComplexity:
|
15
|
+
Max: 9
|
12
16
|
|
13
17
|
# Offense count: 1
|
14
18
|
# Configuration parameters: CountComments, ExcludedMethods.
|
data/.travis.yml
CHANGED
@@ -17,12 +17,34 @@ module Dor
|
|
17
17
|
# @param [String] repo The repository the object resides in. The service recoginzes "dor" and "sdr" at the moment
|
18
18
|
# @param [String] druid The id of the object to delete the workflow from
|
19
19
|
# @param [Boolean] create_accession_wf Option to create accessionWF when closing a version. Defaults to true
|
20
|
-
|
20
|
+
# rubocop:disable Metrics/MethodLength
|
21
|
+
def close_version(*args)
|
22
|
+
case args.size
|
23
|
+
when 3
|
24
|
+
Deprecation.warn(self, 'you provided 3 args, but close_version now takes kwargs')
|
25
|
+
(repo, druid, create_accession_wf) = args
|
26
|
+
when 2
|
27
|
+
Deprecation.warn(self, 'you provided 2 args, but close_version now takes kwargs')
|
28
|
+
(repo, druid) = args
|
29
|
+
create_accession_wf = true
|
30
|
+
when 1
|
31
|
+
opts = args.first
|
32
|
+
repo = opts[:repo]
|
33
|
+
druid = opts[:druid]
|
34
|
+
version = opts[:version]
|
35
|
+
create_accession_wf = opts.key?(:create_accession_wf) ? opts[:create_accession_wf] : true
|
36
|
+
else
|
37
|
+
raise ArgumentError, 'wrong number of arguments, must be 1-3'
|
38
|
+
end
|
39
|
+
|
21
40
|
uri = "#{repo}/objects/#{druid}/versionClose"
|
22
|
-
uri += '?
|
41
|
+
uri += '?' if !create_accession_wf || version
|
42
|
+
uri += "version=#{version}" if version
|
43
|
+
uri += 'create-accession=false' unless create_accession_wf
|
23
44
|
requestor.request(uri, 'post', '')
|
24
45
|
true
|
25
46
|
end
|
47
|
+
# rubocop:enable Metrics/MethodLength
|
26
48
|
|
27
49
|
private
|
28
50
|
|
@@ -756,13 +756,38 @@ RSpec.describe Dor::Workflow::Client do
|
|
756
756
|
end
|
757
757
|
|
758
758
|
let(:url) { 'dor/objects/druid:123/versionClose' }
|
759
|
-
|
760
|
-
|
759
|
+
|
760
|
+
context 'with positional arguments' do
|
761
|
+
before do
|
762
|
+
allow(Deprecation).to receive(:warn)
|
763
|
+
end
|
764
|
+
|
765
|
+
it 'calls the versionClose endpoint with druid' do
|
766
|
+
client.close_version(@repo, @druid)
|
767
|
+
expect(Deprecation).to have_received(:warn)
|
768
|
+
end
|
769
|
+
|
770
|
+
it 'optionally prevents creation of accessionWF' do
|
771
|
+
expect(mock_http_connection).to receive(:post).with('dor/objects/druid:123/versionClose?create-accession=false').and_call_original
|
772
|
+
client.close_version(@repo, @druid, false)
|
773
|
+
expect(Deprecation).to have_received(:warn)
|
774
|
+
end
|
761
775
|
end
|
762
776
|
|
763
|
-
|
764
|
-
|
765
|
-
|
777
|
+
context 'with kwargs' do
|
778
|
+
it 'calls the versionClose endpoint with druid' do
|
779
|
+
client.close_version(repo: @repo, druid: @druid)
|
780
|
+
end
|
781
|
+
|
782
|
+
it 'optionally prevents creation of accessionWF' do
|
783
|
+
expect(mock_http_connection).to receive(:post).with('dor/objects/druid:123/versionClose?create-accession=false').and_call_original
|
784
|
+
client.close_version(repo: @repo, druid: @druid, create_accession_wf: false)
|
785
|
+
end
|
786
|
+
|
787
|
+
it 'optionally passes version' do
|
788
|
+
expect(mock_http_connection).to receive(:post).with('dor/objects/druid:123/versionClose?version=3').and_call_original
|
789
|
+
client.close_version(repo: @repo, druid: @druid, version: 3)
|
790
|
+
end
|
766
791
|
end
|
767
792
|
end
|
768
793
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dor-workflow-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willy Mene
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -252,8 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
252
252
|
- !ruby/object:Gem::Version
|
253
253
|
version: '0'
|
254
254
|
requirements: []
|
255
|
-
|
256
|
-
rubygems_version: 2.7.8
|
255
|
+
rubygems_version: 3.0.3
|
257
256
|
signing_key:
|
258
257
|
specification_version: 4
|
259
258
|
summary: Provides convenience methods to work with the DOR Workflow Service
|