dor-services-client 4.19.0 → 4.20.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/README.md +4 -1
- data/lib/dor/services/client/administrative_tags.rb +52 -0
- data/lib/dor/services/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c4981195f7d4860155b7e39a639d2d83a7203b3c69bef9155388ef1fa32a885
|
4
|
+
data.tar.gz: e091247d8646103a5f61afefbf18259f2d2d7153fea8886b908110b060907e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed6cffd6319bde37a13754b49a6e5b9ddcd234d126e8f0a6c3464464798f563796deba3a31c3f8d06bd691cfdca0dfa9f46b7f1948359ad56917519d60834e02
|
7
|
+
data.tar.gz: 4d044417251b88e091a1c5b45cefa4a0d3c53391f71fd83684aa025b64e2405d3fceef66c1fdbd682f1943159c71767f82518bf390897eeec8c512df74012cd7
|
data/README.md
CHANGED
@@ -138,8 +138,11 @@ object_client.members
|
|
138
138
|
object_client.files.retrieve(filename: filename_string)
|
139
139
|
object_client.files.list
|
140
140
|
|
141
|
-
# Create and list administrative tags for an object
|
141
|
+
# Create, update, destroy, and list administrative tags for an object
|
142
142
|
object_client.administrative_tags.create(tags: ['Tag : One', 'Tag : Two'])
|
143
|
+
object_client.administrative_tags.replace(tags: ['Tag : One', 'Tag : Two']) # like #create but removes current tags first
|
144
|
+
object_client.administrative_tags.update(current: 'Current : Tag', new: 'Replacement : Tag')
|
145
|
+
object_client.administrative_tags.destroy(tag: 'Delete : Me')
|
143
146
|
object_client.administrative_tags.list
|
144
147
|
|
145
148
|
# Create and list release tags for an object
|
@@ -12,6 +12,7 @@ module Dor
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# Creates one or more administrative tags for an object
|
15
|
+
#
|
15
16
|
# @param tags [Array<String>]
|
16
17
|
# @return [Boolean] true if successful
|
17
18
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
@@ -27,7 +28,25 @@ module Dor
|
|
27
28
|
true
|
28
29
|
end
|
29
30
|
|
31
|
+
# Replaces one or more administrative tags for an object
|
32
|
+
#
|
33
|
+
# @param tags [Array<String>]
|
34
|
+
# @return [Boolean] true if successful
|
35
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
36
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
37
|
+
def replace(tags:)
|
38
|
+
resp = connection.post do |req|
|
39
|
+
req.url "#{api_version}/objects/#{object_identifier}/administrative_tags"
|
40
|
+
req.headers['Content-Type'] = 'application/json'
|
41
|
+
req.body = { administrative_tags: tags, replace: true }.to_json
|
42
|
+
end
|
43
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
44
|
+
|
45
|
+
true
|
46
|
+
end
|
47
|
+
|
30
48
|
# List administrative tags for an object
|
49
|
+
#
|
31
50
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
32
51
|
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
33
52
|
# @return [Hash]
|
@@ -41,6 +60,39 @@ module Dor
|
|
41
60
|
JSON.parse(resp.body)
|
42
61
|
end
|
43
62
|
|
63
|
+
# Updates an administrative tag for an object
|
64
|
+
#
|
65
|
+
# @param current [String] current tag to update
|
66
|
+
# @param new [String] new tag to replace current tag
|
67
|
+
# @return [Boolean] true if successful
|
68
|
+
# @raise [NotFoundResponse] when the response is a 404 (object or current tag not found)
|
69
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
70
|
+
def update(current:, new:)
|
71
|
+
resp = connection.put do |req|
|
72
|
+
req.url "#{api_version}/objects/#{object_identifier}/administrative_tags/#{CGI.escape(current)}"
|
73
|
+
req.headers['Content-Type'] = 'application/json'
|
74
|
+
req.body = { administrative_tag: new }.to_json
|
75
|
+
end
|
76
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
77
|
+
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Destroys an administrative tag for an object
|
82
|
+
#
|
83
|
+
# @param tag [String] a tag to destroy
|
84
|
+
# @return [Boolean] true if successful
|
85
|
+
# @raise [NotFoundResponse] when the response is a 404 (object or current tag not found)
|
86
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
87
|
+
def destroy(tag:)
|
88
|
+
resp = connection.delete do |req|
|
89
|
+
req.url "#{api_version}/objects/#{object_identifier}/administrative_tags/#{CGI.escape(tag)}"
|
90
|
+
end
|
91
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
92
|
+
|
93
|
+
true
|
94
|
+
end
|
95
|
+
|
44
96
|
private
|
45
97
|
|
46
98
|
attr_reader :object_identifier
|
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.20.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: 2020-03-
|
12
|
+
date: 2020-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -266,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
266
|
- !ruby/object:Gem::Version
|
267
267
|
version: '0'
|
268
268
|
requirements: []
|
269
|
-
rubygems_version: 3.0.
|
269
|
+
rubygems_version: 3.0.6
|
270
270
|
signing_key:
|
271
271
|
specification_version: 4
|
272
272
|
summary: A client for dor-services-app
|