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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/dor/services/client/object.rb +4 -0
- data/lib/dor/services/client/release_tags.rb +52 -0
- data/lib/dor/services/client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd7841c236c50b58fae7790f830fe16ccdf406046be4739d758bba74dd0155aa
|
4
|
+
data.tar.gz: 7e6f87de10e9112ce4301ead05ca56115ecc7c956d347f3447856f7afe29882f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea9ca5c81c500d8782f89b7ec7a8efc615116e4c98d306ee6c8d16d3fd144d6b36b1a162a266adf681c2a91aa48f5bc842dbccbcfe6e334b38641b45d7524240
|
7
|
+
data.tar.gz: 20ae566854c4f8eb4f95a6861f6c89d0d4594d3590d979fda9774f2a06d7c8dc1b8be5ddaa016479e54759091bba5c14da761abb48e7c01d6246990d9d395837
|
data/Gemfile.lock
CHANGED
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
|
@@ -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
|
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.
|
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.
|
281
|
+
rubygems_version: 3.4.18
|
281
282
|
signing_key:
|
282
283
|
specification_version: 4
|
283
284
|
summary: A client for dor-services-app
|