dor-workflow-client 3.13.0 → 3.14.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: ea39b8e90466517fda9d9c0c8a7d1e6bfe2fe09d38566e51db76031e2768eae0
4
- data.tar.gz: d75001c1f99852c3cd0410ea5cb018abf713162c04fcc81cc43c58817bcae34a
3
+ metadata.gz: 5a00ebf82eddf3b2cce94a9e1eb3d4eeb77e78fb7280131b5f8cd475e611ff1c
4
+ data.tar.gz: fb8e8d16cebc1436e6747c5e601227c786ed007e54507f154dd3c248694f4fa0
5
5
  SHA512:
6
- metadata.gz: 6e414f5936d21fed90a4690ada9cf3df8c6130734c043a9b0e4c178c8fbe17f5320547dc83c0982e17ee11fb660054b644f8d57cf873128ca91fd05aabe31dc7
7
- data.tar.gz: cc096fad25055d2f31fb3344d9af42fddeeb36aa90a12795a620c6b6a14dbd1946fd3996902a6092ecb352bc49bd10f6ef51eab2fd585faf4e039796c6e8fdae
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 2019-09-13 10:43:44 -0500 using RuboCop version 0.63.1.
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: 2
9
+ # Offense count: 4
10
10
  Metrics/AbcSize:
11
- Max: 23
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
@@ -5,7 +5,6 @@ rvm:
5
5
  - 2.5.3
6
6
 
7
7
  env:
8
- - "RAILS_VERSION=4.2.11.1"
9
8
  - "RAILS_VERSION=5.2.3"
10
9
  - "RAILS_VERSION=6.0.0"
11
10
 
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Workflow
5
5
  class Client
6
- VERSION = '3.13.0'
6
+ VERSION = '3.14.0'
7
7
  end
8
8
  end
9
9
  end
@@ -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
- def close_version(repo, druid, create_accession_wf = true)
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 += '?create-accession=false' unless create_accession_wf
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
- it 'calls the versionClose endpoint with druid' do
760
- client.close_version(@repo, @druid)
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
- it 'optionally prevents creation of accessionWF' do
764
- expect(mock_http_connection).to receive(:post).with('dor/objects/druid:123/versionClose?create-accession=false').and_call_original
765
- client.close_version(@repo, @druid, false)
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.13.0
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: 2019-12-12 00:00:00.000000000 Z
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
- rubyforge_project:
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