dor-services-client 2.6.0 → 2.6.1
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.rb +6 -1
- data/lib/dor/services/client/version.rb +1 -1
- data/lib/dor/services/client/virtual_objects.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 837d0e816cb1df5799613665815a452803f643fb780852ac99e097317167e32a
|
4
|
+
data.tar.gz: 9319c72918f4f03a9a8d5617734741ec2f1ed03124fd3b8149b23433ceae995b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02480568fa21b7d716f047bbbbff0043ea03e6368e4c28ab8ef1d8f7365e5a098f1d6448c84ef30463c22488e5749ac0d0e4968ac63882ae40769d6fa469250
|
7
|
+
data.tar.gz: cbf5807c4ae86c1ddf752707a975466c7f4b91a72e4310ca9353435dc4a04d9059a80a443876258b560b24fdcd12833c04c3bafc28d84ed58ec9a3a4289ead47
|
data/README.md
CHANGED
@@ -58,8 +58,11 @@ objects_client = Dor::Services::Client.objects
|
|
58
58
|
# For registering a non-existent object
|
59
59
|
objects_client.register(params: {})
|
60
60
|
|
61
|
+
# For interacting with virtual objects
|
62
|
+
virtual_objects_client = Dor::Services::Client.virtual_objects
|
63
|
+
|
61
64
|
# Create a batch of virtual objects
|
62
|
-
|
65
|
+
virtual_objects_client.create(virtual_objects: [{ parent_id: '', child_ids: [''] }])
|
63
66
|
|
64
67
|
# For performing operations on a known, registered object
|
65
68
|
object_client = Dor::Services::Client.object(object_identifier)
|
data/lib/dor/services/client.rb
CHANGED
@@ -66,6 +66,11 @@ module Dor
|
|
66
66
|
@objects ||= Objects.new(connection: connection, version: DEFAULT_VERSION)
|
67
67
|
end
|
68
68
|
|
69
|
+
# @return [Dor::Services::Client::VirtualObjects] an instance of the `Client::VirtualObjects` class
|
70
|
+
def virtual_objects
|
71
|
+
@virtual_objects ||= VirtualObjects.new(connection: connection, version: DEFAULT_VERSION)
|
72
|
+
end
|
73
|
+
|
69
74
|
class << self
|
70
75
|
# @param [String] url
|
71
76
|
# @param [String] token a bearer token for HTTP auth
|
@@ -82,7 +87,7 @@ module Dor
|
|
82
87
|
self
|
83
88
|
end
|
84
89
|
|
85
|
-
delegate :objects, :object, to: :instance
|
90
|
+
delegate :objects, :object, :virtual_objects, to: :instance
|
86
91
|
end
|
87
92
|
|
88
93
|
attr_writer :url, :token, :token_header, :connection
|
@@ -6,16 +6,16 @@ module Dor
|
|
6
6
|
# API calls around "virtual objects" in DOR
|
7
7
|
class VirtualObjects < VersionedService
|
8
8
|
# Create a batch of virtual objects in DOR
|
9
|
-
# @param
|
9
|
+
# @param virtual_objects [Array] required array of virtual object params (see dor-services-app)
|
10
10
|
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
11
11
|
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
12
12
|
# @return [NilClass] nil if no errors
|
13
|
-
def create(
|
13
|
+
def create(virtual_objects:)
|
14
14
|
resp = connection.post do |req|
|
15
15
|
req.url "#{api_version}/virtual_objects"
|
16
16
|
req.headers['Content-Type'] = 'application/json'
|
17
17
|
req.headers['Accept'] = 'application/json'
|
18
|
-
req.body =
|
18
|
+
req.body = { virtual_objects: virtual_objects }.to_json
|
19
19
|
end
|
20
20
|
return if resp.success?
|
21
21
|
|