dor-services-client 7.0.0 → 7.1.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: 5bb8a9ddf0dc77dd42ad241f0ff58a247abfbea76b679d4f82da04cff10ffdda
4
- data.tar.gz: c857219027ca4cc668f19931dea4da44b0e91d0efa757bc6e2220e285538360e
3
+ metadata.gz: ddf98aa77b3f6b4f415905dc35f32e6ee79c8c73783e948d0a829336462af5e6
4
+ data.tar.gz: '09a46813486cca151fecba1c366fdb13e6a48d91200f69385cabac7cd2f53ba7'
5
5
  SHA512:
6
- metadata.gz: a676bcbbcfe6b425e3f2a6789d253e6d44d91bdedc61220e937ed3f30214caaee2bb943462756449f8ca415ba1d8494822a00d07a081101c8e8aed924d320c80
7
- data.tar.gz: b5fdfd955d1ad5a1f9e39217f765e92af23775bf087543d02aedfae3ebfab4ea23a23ec3a18cd15aa058dcf175be013507b29b87d8b643011e74b374d76a4f44
6
+ metadata.gz: 8fe163bcd4dcd39f507ffd95b240d833d5376cd4e2f894a65716107ee1150979f9a6e5182fcb28d373d2733dbc296c6e9ab48a83f40806c9ca8eaef9b07df61c
7
+ data.tar.gz: ac14e775bbce18d41babc1fc0c74f84017f5b40bba6dbb775c62132ab9c43a425f1681c8cc568a99fe976f422ec20bfe0b081f8a2e5862fcb41d1a85c1580831
data/README.md CHANGED
@@ -61,6 +61,7 @@ objects_client = Dor::Services::Client.objects
61
61
 
62
62
  # Register a non-existent object
63
63
  objects_client.register(params: {})
64
+ objects_client.register(params: {}, assign_doi: true)
64
65
 
65
66
  # Interact with virtual objects
66
67
  virtual_objects_client = Dor::Services::Client.virtual_objects
@@ -8,10 +8,11 @@ module Dor
8
8
  # API calls that are about a repository objects
9
9
  class Objects < VersionedService
10
10
  # Creates a new object in DOR
11
- # @param [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO]
11
+ # @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO]
12
+ # @param assign_doi [Boolean]
12
13
  # @return [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] the returned model
13
- def register(params:)
14
- json_str = register_response(params: params)
14
+ def register(params:, assign_doi: false)
15
+ json_str = register_response(params: params, assign_doi: assign_doi)
15
16
  json = JSON.parse(json_str)
16
17
 
17
18
  Cocina::Models.build(json)
@@ -21,14 +22,16 @@ module Dor
21
22
 
22
23
  # make the registration request to the server
23
24
  # @param params [Hash] optional params (see dor-services-app)
25
+ # @param assign_doi [Boolean]
24
26
  # @raise [UnexpectedResponse] on an unsuccessful response from the server
25
27
  # @return [String] the raw JSON from the server
26
- def register_response(params:)
28
+ def register_response(params:, assign_doi:)
27
29
  resp = connection.post do |req|
28
30
  req.url "#{api_version}/objects"
29
31
  req.headers['Content-Type'] = 'application/json'
30
32
  # asking the service to return JSON (else it'll be plain text)
31
33
  req.headers['Accept'] = 'application/json'
34
+ req.params[:assign_doi] = true if assign_doi
32
35
  req.body = params.to_json
33
36
  end
34
37
  return resp.body if resp.success?
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '7.0.0'
6
+ VERSION = '7.1.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: 7.0.0
4
+ version: 7.1.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: 2021-07-06 00:00:00.000000000 Z
12
+ date: 2021-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport