dor-services-client 4.15.0 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +0 -1
- data/README.md +4 -0
- data/lib/dor/services/client/administrative_tags.rb +50 -0
- data/lib/dor/services/client/object.rb +4 -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: ddcb66b9e16f3e1f95ed1062d8a0841a6e806398eb103ce5738a72367529fff5
|
4
|
+
data.tar.gz: '090397a1d9d160f9b510dc4d1e343d4d9034726dfb4cc51e1355643d1cf05ffa'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5711db29593514d07bebe7fc4a68e4cb4ae702408a2b0f43d8cfa20f0abbd5a5b0ff97562656f074ef3945009ab765647614d01fbb8c174fa9ed207bded6d76
|
7
|
+
data.tar.gz: eae97208ee219e18531542d227469726f9c992760e3d92f7687b19f5629b116ac18a7b3c51dfc6650a32cbf5f07bfaa6384ba577f529b19b49726ddf968e67b0
|
data/.rspec
CHANGED
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
|
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.
|
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.
|
248
|
+
rubygems_version: 3.0.6
|
248
249
|
signing_key:
|
249
250
|
specification_version: 4
|
250
251
|
summary: A client for dor-services-app
|