dor-services-client 4.16.0 → 4.17.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: ddcb66b9e16f3e1f95ed1062d8a0841a6e806398eb103ce5738a72367529fff5
4
- data.tar.gz: '090397a1d9d160f9b510dc4d1e343d4d9034726dfb4cc51e1355643d1cf05ffa'
3
+ metadata.gz: 179d62023a6b0414db6ebf63659433567afb4b12efd9f4597adef9a2048f5c55
4
+ data.tar.gz: 12306e6cd51503c1e3dc396f42c88c5e776c8dd4db3c616a9be778381366f33e
5
5
  SHA512:
6
- metadata.gz: d5711db29593514d07bebe7fc4a68e4cb4ae702408a2b0f43d8cfa20f0abbd5a5b0ff97562656f074ef3945009ab765647614d01fbb8c174fa9ed207bded6d76
7
- data.tar.gz: eae97208ee219e18531542d227469726f9c992760e3d92f7687b19f5629b116ac18a7b3c51dfc6650a32cbf5f07bfaa6384ba577f529b19b49726ddf968e67b0
6
+ metadata.gz: 6f183fac6270cf47ae62f239f24079214623eec3fb9618b1bb4d78e869f707f4708b1e4d2b7b9013a9388948508372f78c207e69fd060ef3e2a2b212008cd32b
7
+ data.tar.gz: 6085886046e129e6ccbc42b2030346901c866242ac62dc60c601713314ab228d8e84a5bdc24deb7b56bbae06635684da6abcc5851172445655bd4a8703a0ada3
data/README.md CHANGED
@@ -90,6 +90,9 @@ object_client.publish(workflow: 'releaseWF')
90
90
  # Shelve an object (push to Stacks)
91
91
  object_client.shelve
92
92
 
93
+ # Start accessioning an object (initialize assemblyWF or specified workflow, and version object if needed)
94
+ object_client.accession.start(**versioning_params)
95
+
93
96
  # Preserve an object (push to SDR)
94
97
  object_client.preserve
95
98
 
@@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
 
25
25
  spec.add_dependency 'activesupport', '>= 4.2', '< 7'
26
- spec.add_dependency 'cocina-models', '~> 0.25.0'
26
+ spec.add_dependency 'cocina-models', '~> 0.26.0'
27
27
  spec.add_dependency 'deprecation', '>= 0'
28
- spec.add_dependency 'faraday', '~> 0.15'
28
+ spec.add_dependency 'faraday', '>= 0.15', '< 2'
29
29
  spec.add_dependency 'moab-versioning', '~> 4.0'
30
30
  spec.add_dependency 'zeitwerk', '~> 2.1'
31
31
 
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ module Services
5
+ class Client
6
+ # API calls that are about starting accessioning on a repository object
7
+ class Accession < VersionedService
8
+ # @param connection [Faraday::Connection] an HTTP connection to dor-services-app
9
+ # @param version [String] id for the version of the API call
10
+ # @param object_identifier [String] the pid for the object
11
+ def initialize(connection:, version:, object_identifier:)
12
+ super(connection: connection, version: version)
13
+ @object_identifier = object_identifier
14
+ end
15
+
16
+ # Start accession on an object (start specified workflow, assemblyWF by default, and version if needed)
17
+ # @param params [Hash<Symbol,String>] optional parameter hash
18
+ # @option params [String] :significance set significance (major/minor/patch) of version change
19
+ # @option params [String] :description set description of version change
20
+ # @option params [String] :opening_user_name add opening username to the events datastream
21
+ # @option params [String] :workflow the workflow to start (defaults to 'assemblyWF')
22
+ # @return [Boolean] true on success
23
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
24
+ # @raise [UnexpectedResponse] when the response is not successful.
25
+ def start(params = {})
26
+ resp = connection.post do |req|
27
+ req.url path
28
+ req.params = params
29
+ end
30
+ return true if resp.success?
31
+
32
+ raise_exception_based_on_response!(resp)
33
+ end
34
+
35
+ private
36
+
37
+ attr_reader :object_identifier
38
+
39
+ def path
40
+ "#{api_version}/objects/#{object_identifier}/accession"
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -47,6 +47,10 @@ module Dor
47
47
  @embargo ||= Embargo.new(parent_params)
48
48
  end
49
49
 
50
+ def accession(params = {})
51
+ @accession ||= Accession.new(parent_params.merge(params))
52
+ end
53
+
50
54
  # Retrieves the Cocina model
51
55
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
52
56
  # @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 = '4.16.0'
6
+ VERSION = '4.17.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: 4.16.0
4
+ version: 4.17.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: 2020-02-27 00:00:00.000000000 Z
12
+ date: 2020-03-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -37,14 +37,14 @@ dependencies:
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.25.0
40
+ version: 0.26.0
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.25.0
47
+ version: 0.26.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -63,16 +63,22 @@ dependencies:
63
63
  name: faraday
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.15'
69
+ - - "<"
70
+ - !ruby/object:Gem::Version
71
+ version: '2'
69
72
  type: :runtime
70
73
  prerelease: false
71
74
  version_requirements: !ruby/object:Gem::Requirement
72
75
  requirements:
73
- - - "~>"
76
+ - - ">="
74
77
  - !ruby/object:Gem::Version
75
78
  version: '0.15'
79
+ - - "<"
80
+ - !ruby/object:Gem::Version
81
+ version: '2'
76
82
  - !ruby/object:Gem::Dependency
77
83
  name: moab-versioning
78
84
  requirement: !ruby/object:Gem::Requirement
@@ -207,6 +213,7 @@ files:
207
213
  - bin/setup
208
214
  - dor-services-client.gemspec
209
215
  - lib/dor/services/client.rb
216
+ - lib/dor/services/client/accession.rb
210
217
  - lib/dor/services/client/administrative_tags.rb
211
218
  - lib/dor/services/client/async_result.rb
212
219
  - lib/dor/services/client/background_job_results.rb
@@ -245,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
245
252
  - !ruby/object:Gem::Version
246
253
  version: '0'
247
254
  requirements: []
248
- rubygems_version: 3.0.6
255
+ rubygems_version: 3.0.3
249
256
  signing_key:
250
257
  specification_version: 4
251
258
  summary: A client for dor-services-app