dor-services-client 4.15.0 → 4.16.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: 863e395fd563509f80c135875c0ab84a47e035502e8f9296737d9a7e1e963dc4
4
- data.tar.gz: e21da87ef16016b30fbccb04ad34ce3fb26152d4fe639cfd79dc4f293a4643eb
3
+ metadata.gz: ddcb66b9e16f3e1f95ed1062d8a0841a6e806398eb103ce5738a72367529fff5
4
+ data.tar.gz: '090397a1d9d160f9b510dc4d1e343d4d9034726dfb4cc51e1355643d1cf05ffa'
5
5
  SHA512:
6
- metadata.gz: 109d72ef302813ec49ec7a9fdbf8cfa293b4f42b3e4f9eac18653275a1e56fa4d78e882118f6a454c0d23f81bb9efb54615abd23fa89f086db91293307de1325
7
- data.tar.gz: 1d0140b61e980c77e378a37233d0b43f4d06fe6742d9265f47211706c1e6a34e983b20d7821d0135b0eda2ba1b9344cba5d400e7d8e2993043ef9276b62730d2
6
+ metadata.gz: d5711db29593514d07bebe7fc4a68e4cb4ae702408a2b0f43d8cfa20f0abbd5a5b0ff97562656f074ef3945009ab765647614d01fbb8c174fa9ed207bded6d76
7
+ data.tar.gz: eae97208ee219e18531542d227469726f9c992760e3d92f7687b19f5629b116ac18a7b3c51dfc6650a32cbf5f07bfaa6384ba577f529b19b49726ddf968e67b0
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
- --format documentation
2
1
  --color
3
2
  --require spec_helper
data/README.md CHANGED
@@ -135,6 +135,10 @@ object_client.members
135
135
  object_client.files.retrieve(filename: filename_string)
136
136
  object_client.files.list
137
137
 
138
+ # Create and list administrative tags for an object
139
+ object_client.administrative_tags.create(tags: ['Tag : One', 'Tag : Two'])
140
+ object_client.administrative_tags.list
141
+
138
142
  # Create and list release tags for an object
139
143
  object_client.release_tags.create(release: release, what: what, to: to, who: who)
140
144
  object_client.release_tags.list
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ module Services
5
+ class Client
6
+ # Interact with administrative tags endpoint for a given object
7
+ class AdministrativeTags < 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
+ # Creates one or more administrative tags for an object
15
+ # @param tags [Array<String>]
16
+ # @return [Boolean] true if successful
17
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
18
+ # @raise [UnexpectedResponse] if the request is unsuccessful.
19
+ def create(tags:)
20
+ resp = connection.post do |req|
21
+ req.url "#{api_version}/objects/#{object_identifier}/administrative_tags"
22
+ req.headers['Content-Type'] = 'application/json'
23
+ req.body = { administrative_tags: tags }.to_json
24
+ end
25
+ raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
26
+
27
+ true
28
+ end
29
+
30
+ # List administrative tags for an object
31
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
32
+ # @raise [UnexpectedResponse] if the request is unsuccessful.
33
+ # @return [Hash]
34
+ def list
35
+ resp = connection.get do |req|
36
+ req.url "#{api_version}/objects/#{object_identifier}/administrative_tags"
37
+ end
38
+
39
+ raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
40
+
41
+ JSON.parse(resp.body)
42
+ end
43
+
44
+ private
45
+
46
+ attr_reader :object_identifier
47
+ end
48
+ end
49
+ end
50
+ end
@@ -35,6 +35,10 @@ module Dor
35
35
  @release_tags ||= ReleaseTags.new(parent_params)
36
36
  end
37
37
 
38
+ def administrative_tags
39
+ @administrative_tags ||= AdministrativeTags.new(parent_params)
40
+ end
41
+
38
42
  def version
39
43
  @version ||= ObjectVersion.new(parent_params)
40
44
  end
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '4.15.0'
6
+ VERSION = '4.16.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.15.0
4
+ version: 4.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -207,6 +207,7 @@ files:
207
207
  - bin/setup
208
208
  - dor-services-client.gemspec
209
209
  - lib/dor/services/client.rb
210
+ - lib/dor/services/client/administrative_tags.rb
210
211
  - lib/dor/services/client/async_result.rb
211
212
  - lib/dor/services/client/background_job_results.rb
212
213
  - lib/dor/services/client/collections.rb
@@ -244,7 +245,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
245
  - !ruby/object:Gem::Version
245
246
  version: '0'
246
247
  requirements: []
247
- rubygems_version: 3.0.3
248
+ rubygems_version: 3.0.6
248
249
  signing_key:
249
250
  specification_version: 4
250
251
  summary: A client for dor-services-app