dor-services-client 14.5.0 → 14.6.1

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: b8ee28c0d6503ac6cc8e3c39aca64fd7d191cc6f6a7bac04ef4f7424bf92a760
4
- data.tar.gz: cf304665caa7b4f9e5412da754e784205b493e99add1e88dede7f37d34529819
3
+ metadata.gz: a552471ebb7a9502fef71faf54eac00a0b798c559c3c8f64d464b8451c0a65cd
4
+ data.tar.gz: 6e2d889807437760359d6bce44e5eaa30e805eefd4a2be505bbf05b871a182d8
5
5
  SHA512:
6
- metadata.gz: 04f1f79f78d69c6e150e875fd962b95e61bf52f73aff4abc6471df993ff1969e5b7121e8d3e6a437329768df227ef326485361a945df827ac71ce0bc73d999e0
7
- data.tar.gz: 4508c1c0e766235e898d40c0a7da1609ba1e203350141c0f091be66508205a07a5b530271479dd7048143b63736adbe0e8989b4492395dee2632107c0b7c711d
6
+ metadata.gz: 16f2629ff57c968d20a3500c1056ef1e67fbbd31c8b32c18e6ce8854e2123b8c00b42a0adf0834f85f96f3c6e4cf90f05381e477e83caf3015461419fffac8a4
7
+ data.tar.gz: 0044a1dc227550e4d676724c814f6fc8334218392f4e8619522ea576b4b04434d2d09a952db8ac889148bb8055a96c97f73eb0f5ed7711f4fe5a02cb64cda2e1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (14.5.0)
4
+ dor-services-client (14.6.1)
5
5
  activesupport (>= 4.2, < 8)
6
6
  cocina-models (~> 0.96.0)
7
7
  deprecation
@@ -151,10 +151,13 @@ GEM
151
151
  rubocop (~> 1.41)
152
152
  rubocop-factory_bot (2.25.1)
153
153
  rubocop (~> 1.41)
154
- rubocop-rspec (2.27.1)
154
+ rubocop-rspec (2.28.0)
155
155
  rubocop (~> 1.40)
156
156
  rubocop-capybara (~> 2.17)
157
157
  rubocop-factory_bot (~> 2.22)
158
+ rubocop-rspec_rails (~> 2.28)
159
+ rubocop-rspec_rails (2.28.2)
160
+ rubocop (~> 1.40)
158
161
  ruby-progressbar (1.13.0)
159
162
  simplecov (0.22.0)
160
163
  docile (~> 1.1)
data/README.md CHANGED
@@ -120,6 +120,9 @@ object_client.notify_goobi
120
120
  # Manage versions
121
121
  object_client.version.inventory
122
122
  object_client.version.current
123
+ # Returns a struct containing the status.
124
+ # Status includes whether the object is open, assembling, accessioning, or closeable.
125
+ object_client.version.status
123
126
  object_client.version.openable?
124
127
  # see dor-services-app openapi.yml for optional params
125
128
  object_client.version.open(description: 'Changed title')
@@ -6,6 +6,33 @@ module Dor
6
6
  # API calls that are about versions
7
7
  class ObjectVersion < VersionedService
8
8
  Version = Struct.new(:versionId, :tag, :message, keyword_init: true)
9
+ VersionStatus = Struct.new(:versionId, :open, :openable, :assembling, :accessioning, :closeable, keyword_init: true) do
10
+ alias_method :version, :versionId
11
+
12
+ def open?
13
+ open
14
+ end
15
+
16
+ def openable?
17
+ openable
18
+ end
19
+
20
+ def assembling?
21
+ assembling
22
+ end
23
+
24
+ def accessioning?
25
+ accessioning
26
+ end
27
+
28
+ def closed?
29
+ !open
30
+ end
31
+
32
+ def closeable?
33
+ closeable
34
+ end
35
+ end
9
36
 
10
37
  # @param object_identifier [String] the pid for the object
11
38
  def initialize(connection:, version:, object_identifier:)
@@ -95,6 +122,17 @@ module Dor
95
122
  JSON.parse(resp.body).fetch('versions').map { |params| Version.new(**params.symbolize_keys!) }
96
123
  end
97
124
 
125
+ # @return [VersionStatus] status of the version
126
+ # @raise [UnexpectedResponse] on an unsuccessful response from the server
127
+ def status
128
+ resp = connection.get do |req|
129
+ req.url "#{base_path}/status"
130
+ end
131
+ raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
132
+
133
+ VersionStatus.new(JSON.parse(resp.body).symbolize_keys!)
134
+ end
135
+
98
136
  private
99
137
 
100
138
  attr_reader :object_identifier
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '14.5.0'
6
+ VERSION = '14.6.1'
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: 14.5.0
4
+ version: 14.6.1
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: 2024-03-29 00:00:00.000000000 Z
12
+ date: 2024-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -278,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
278
  - !ruby/object:Gem::Version
279
279
  version: '0'
280
280
  requirements: []
281
- rubygems_version: 3.5.6
281
+ rubygems_version: 3.5.7
282
282
  signing_key:
283
283
  specification_version: 4
284
284
  summary: A client for dor-services-app