dor-services-client 14.3.0 → 14.4.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: dc68f7d750dc81e4b321c1e18e20982084fc65e9a4282f5c0e3b2bce8674f107
4
- data.tar.gz: 84c9e262f5fcb42b52ed09ce8a67ee08580fcce73e1dc2177d3029b30d20e338
3
+ metadata.gz: fd7841c236c50b58fae7790f830fe16ccdf406046be4739d758bba74dd0155aa
4
+ data.tar.gz: 7e6f87de10e9112ce4301ead05ca56115ecc7c956d347f3447856f7afe29882f
5
5
  SHA512:
6
- metadata.gz: dbc3b77fff70d1ee722c63b31e1eac894b0e659186bb078237c31ca047d8ea84a75aa0fff8d336938143915484c856ffc64fe861377e40ddfebb78465c79671b
7
- data.tar.gz: 755f7ecbe52cb1fd7bbcff3d5332e923ba391136204045689a2bf2cff966d8e390635282c11e9d495719679ae32f330b5d4e801e17971e8cdc38eeeabf5e3498
6
+ metadata.gz: ea9ca5c81c500d8782f89b7ec7a8efc615116e4c98d306ee6c8d16d3fd144d6b36b1a162a266adf681c2a91aa48f5bc842dbccbcfe6e334b38641b45d7524240
7
+ data.tar.gz: 20ae566854c4f8eb4f95a6861f6c89d0d4594d3590d979fda9774f2a06d7c8dc1b8be5ddaa016479e54759091bba5c14da761abb48e7c01d6246990d9d395837
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (14.3.0)
4
+ dor-services-client (14.4.0)
5
5
  activesupport (>= 4.2, < 8)
6
6
  cocina-models (~> 0.95.1)
7
7
  deprecation
data/README.md CHANGED
@@ -145,6 +145,10 @@ object_client.administrative_tags.update(current: 'Current : Tag', new: 'Replace
145
145
  object_client.administrative_tags.destroy(tag: 'Delete : Me')
146
146
  object_client.administrative_tags.list
147
147
 
148
+ # Create and list release tags for an object
149
+ object_client.release_tags.create(tag: Cocina::Models::Tag.new(to: 'Searchworks'))
150
+ object_client.release_tags.list
151
+
148
152
  # Create and list events for an object
149
153
  object_client.events.create(type: type, data: data)
150
154
  object_client.events.list
@@ -30,6 +30,10 @@ module Dor
30
30
  @administrative_tags ||= AdministrativeTags.new(**parent_params)
31
31
  end
32
32
 
33
+ def release_tags
34
+ @release_tags ||= ReleaseTags.new(**parent_params)
35
+ end
36
+
33
37
  def version
34
38
  @version ||= ObjectVersion.new(**parent_params)
35
39
  end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ module Services
5
+ class Client
6
+ # Interact with release tags endpoint for a given object
7
+ class ReleaseTags < VersionedService
8
+ # @param object_identifier [String] the pid for the object
9
+ def initialize(connection:, version:, object_identifier:)
10
+ super(connection: connection, version: version)
11
+ @object_identifier = object_identifier
12
+ end
13
+
14
+ # Create a release tag for an object
15
+ #
16
+ # @param tag [Cocina::Models::ReleaseTag]
17
+ # @return [Boolean] true if successful
18
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
19
+ # @raise [UnexpectedResponse] if the request is unsuccessful.
20
+ def create(tag:)
21
+ resp = connection.post do |req|
22
+ req.url "#{api_version}/objects/#{object_identifier}/release_tags"
23
+ req.headers['Content-Type'] = 'application/json'
24
+ req.body = tag.to_json
25
+ end
26
+ raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
27
+
28
+ true
29
+ end
30
+
31
+ # List release tags for an object
32
+ #
33
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
34
+ # @raise [UnexpectedResponse] if the request is unsuccessful.
35
+ # @return [Array<Cocina::Models::ReleaseTag>]
36
+ def list
37
+ resp = connection.get do |req|
38
+ req.url "#{api_version}/objects/#{object_identifier}/release_tags"
39
+ end
40
+
41
+ raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
42
+
43
+ JSON.parse(resp.body).map { |tag_data| Cocina::Models::ReleaseTag.new(tag_data) }
44
+ end
45
+
46
+ private
47
+
48
+ attr_reader :object_identifier
49
+ end
50
+ end
51
+ end
52
+ end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '14.3.0'
6
+ VERSION = '14.4.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.3.0
4
+ version: 14.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -249,6 +249,7 @@ files:
249
249
  - lib/dor/services/client/object.rb
250
250
  - lib/dor/services/client/object_version.rb
251
251
  - lib/dor/services/client/objects.rb
252
+ - lib/dor/services/client/release_tags.rb
252
253
  - lib/dor/services/client/response_error_formatter.rb
253
254
  - lib/dor/services/client/transfer.rb
254
255
  - lib/dor/services/client/version.rb
@@ -277,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
278
  - !ruby/object:Gem::Version
278
279
  version: '0'
279
280
  requirements: []
280
- rubygems_version: 3.4.14
281
+ rubygems_version: 3.4.18
281
282
  signing_key:
282
283
  specification_version: 4
283
284
  summary: A client for dor-services-app