dor-services-client 2.5.1 → 2.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: add29434a7d092987f42745ab21360a8b07316240ef094b11b0c7efa798c1040
4
- data.tar.gz: 81aab66662678c76b1c3e266df5d5d730f59760e9548521894de38ac60aa151f
3
+ metadata.gz: eb4e61bec082f3dec6a95359d667af8a162c7e3f8d6bd5c5a27fe1350ffb8cb0
4
+ data.tar.gz: dda521e88bbf4d133309efe559bf9e66677edcd047e7bb3416a8e13d0b234e8f
5
5
  SHA512:
6
- metadata.gz: 27f4b988581fe4236e8fcf5c204ed70fdf50c02c8eacf3832b2529dab12123c671ea46075c53f1b40ad2b3ab303f78d1c0463e66daacc526bea55f0bc8def2b2
7
- data.tar.gz: ada02ea8750cae5ac2979282f17a614a8f5569342506c14c8a617960a17c8d77d6a16165d37c354d91c6d8c8716fbf6c9963fedce6f91afc8c8bc5d840397bfd
6
+ metadata.gz: 9566af655ae58b4617e810afb0b324135a310b8d67371753c325852b7df514b2975979de1422f06d2d4380065719490a65253e67bbf2e589450ac1e9a0145689
7
+ data.tar.gz: 2a36b54ecc637e677ac84ba33ff68852392c23aefe2bc23551c9672ec322dcf71d8ffa7a7ea3d46454abfc03aeb6693db6c29a3ad0b7b6aad8ce8af546b71854
data/README.md CHANGED
@@ -52,10 +52,15 @@ Note that the client may **not** be used without first having been configured, a
52
52
  Dor::Services:Client provides a number of methods to simplify connecting to the RESTful HTTP API of dor-services-app. In this section we list all of the available methods, reflecting how much of the API the client covers. For details see the [API docs](https://www.rubydoc.info/github/sul-dlss/dor-services-client/master/Dor/Services/Client)
53
53
 
54
54
  ```ruby
55
- # For registering a non-existent object
55
+ # For performing operations on one or more objects
56
56
  objects_client = Dor::Services::Client.objects
57
+
58
+ # For registering a non-existent object
57
59
  objects_client.register(params: {})
58
60
 
61
+ # Create a batch of virtual objects
62
+ objects_client.create_virtual_objects(parent_druid: '', child_druids: [''])
63
+
59
64
  # For performing operations on a known, registered object
60
65
  object_client = Dor::Services::Client.object(object_identifier)
61
66
 
@@ -103,6 +103,7 @@ module Dor
103
103
  raise_exception_based_on_response!(resp)
104
104
  end
105
105
 
106
+ # TODO: Remove once Argo is using `VirtualObjects#create` instead.
106
107
  # Does a virtual-merge of the children into the parent
107
108
  # @param [Array<String>] child_druids the identifier of the children
108
109
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '2.5.1'
6
+ VERSION = '2.6.0'
7
7
  end
8
8
  end
9
9
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dor
4
+ module Services
5
+ class Client
6
+ # API calls around "virtual objects" in DOR
7
+ class VirtualObjects < VersionedService
8
+ # Create a batch of virtual objects in DOR
9
+ # @param params [Hash] required hash params (see dor-services-app)
10
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
11
+ # @raise [UnexpectedResponse] on an unsuccessful response from the server
12
+ # @return [NilClass] nil if no errors
13
+ def create(params:)
14
+ resp = connection.post do |req|
15
+ req.url "#{api_version}/virtual_objects"
16
+ req.headers['Content-Type'] = 'application/json'
17
+ req.headers['Accept'] = 'application/json'
18
+ req.body = params.to_json
19
+ end
20
+ return if resp.success?
21
+
22
+ raise_exception_based_on_response!(resp)
23
+ end
24
+
25
+ private
26
+
27
+ def raise_exception_based_on_response!(response)
28
+ raise (response.status == 404 ? NotFoundResponse : UnexpectedResponse),
29
+ ResponseErrorFormatter.format(response: response)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ 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: 2.5.1
4
+ version: 2.6.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: 2019-09-09 00:00:00.000000000 Z
12
+ date: 2019-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -219,6 +219,7 @@ files:
219
219
  - lib/dor/services/client/sdr.rb
220
220
  - lib/dor/services/client/version.rb
221
221
  - lib/dor/services/client/versioned_service.rb
222
+ - lib/dor/services/client/virtual_objects.rb
222
223
  - lib/dor/services/client/workspace.rb
223
224
  homepage: https://github.com/sul-dlss/dor-services-client
224
225
  licenses: []
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
240
  version: '0'
240
241
  requirements: []
241
242
  rubyforge_project:
242
- rubygems_version: 2.7.6
243
+ rubygems_version: 2.7.8
243
244
  signing_key:
244
245
  specification_version: 4
245
246
  summary: A client for dor-services-app