dor-services-client 14.5.0 → 14.6.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: b8ee28c0d6503ac6cc8e3c39aca64fd7d191cc6f6a7bac04ef4f7424bf92a760
4
- data.tar.gz: cf304665caa7b4f9e5412da754e784205b493e99add1e88dede7f37d34529819
3
+ metadata.gz: f174f312d81c83f4eb16c9d833623fb69b8a010f4afbca1b57018a38819c10f2
4
+ data.tar.gz: 7230f8d8093bc586cb5a083b7b292c12d47fbba648e1999f3c697bcb7d56a216
5
5
  SHA512:
6
- metadata.gz: 04f1f79f78d69c6e150e875fd962b95e61bf52f73aff4abc6471df993ff1969e5b7121e8d3e6a437329768df227ef326485361a945df827ac71ce0bc73d999e0
7
- data.tar.gz: 4508c1c0e766235e898d40c0a7da1609ba1e203350141c0f091be66508205a07a5b530271479dd7048143b63736adbe0e8989b4492395dee2632107c0b7c711d
6
+ metadata.gz: d7d5cffdeb8ce04d90055bce6a9e5a751dcf7eaef4483e7f206eb10a68eecd3c3519d2295b470e006b88d1d2b2bbc8ae47fdaae8ab45e28d403bdc9b68615c28
7
+ data.tar.gz: dbcf6972c5b6dacd76407eb6a8573377ea0372a0447f9c834a5a1803b6a9cc6d0d2d25f83b90cec6ec02e9f7ddd6648e51d4175ad7e62ef4bc48fead47f7daa6
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.0)
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,31 @@ 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
+ def open?
11
+ open
12
+ end
13
+
14
+ def openable?
15
+ openable
16
+ end
17
+
18
+ def assembling?
19
+ assembling
20
+ end
21
+
22
+ def accessioning?
23
+ accessioning
24
+ end
25
+
26
+ def closed?
27
+ !open
28
+ end
29
+
30
+ def closeable?
31
+ closeable
32
+ end
33
+ end
9
34
 
10
35
  # @param object_identifier [String] the pid for the object
11
36
  def initialize(connection:, version:, object_identifier:)
@@ -95,6 +120,17 @@ module Dor
95
120
  JSON.parse(resp.body).fetch('versions').map { |params| Version.new(**params.symbolize_keys!) }
96
121
  end
97
122
 
123
+ # @return [VersionStatus] status of the version
124
+ # @raise [UnexpectedResponse] on an unsuccessful response from the server
125
+ def status
126
+ resp = connection.get do |req|
127
+ req.url "#{base_path}/status"
128
+ end
129
+ raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
130
+
131
+ VersionStatus.new(JSON.parse(resp.body).symbolize_keys!)
132
+ end
133
+
98
134
  private
99
135
 
100
136
  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.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: 14.5.0
4
+ version: 14.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: 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