dor-services-client 15.9.1 → 15.11.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: 7b706314b20512aac59b60e0b5ed725ca1dc5800c8b9839b5a23437fb00d531c
4
- data.tar.gz: 268af5981c74b5b3894cf4714b2d7c01b23fdca1078202c612a6b7ffe33a229f
3
+ metadata.gz: 18ff6ef4f51e40372f52681a6bbe257c347ab020e3512dd8d64b8b760c757a3b
4
+ data.tar.gz: 76eb8acbc819956390a0b60b20d88ffd62fdf698430d4b9c469daaea0b2160c9
5
5
  SHA512:
6
- metadata.gz: 66eb41e6bcb8124d02b9988456f03e8383cf68485c9d537d7502f43888d9ccf891c64d31e66fbc7948a8dc768637bcfd2922531168c2d1f954e519862993230f
7
- data.tar.gz: 1e1b20670e6f8a134a785fa2015a3f79c0ac7a6fd757ac7c8e657c9b3b97830ca86ea59f731b80af9049d57cb85b46355ae29dd83d2985e90c42c0c850499975
6
+ metadata.gz: d5639ed16ce0185cc344ae98459593e91bf2286223500a182242e51820041021f8ac8b2685935a0213d842084e9a955b7bc482c03e639b6568768c3f128dc318
7
+ data.tar.gz: 14256c492c36a3c03975a00393325541e6a65896ee49ef2e0bfba40f283dd1e3bc56c36cd0f398b6a3851552d875f4e7edf5d5f916389fe6ccbf06c75d1915c1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (15.9.1)
4
+ dor-services-client (15.11.0)
5
5
  activesupport (>= 7.0.0)
6
6
  cocina-models (~> 0.103.2)
7
7
  deprecation
data/README.md CHANGED
@@ -60,7 +60,7 @@ objects_client = Dor::Services::Client.objects
60
60
 
61
61
  # Register a non-existent object
62
62
  objects_client.register(params: {})
63
- objects_client.register(params: {}, assign_doi: true)
63
+ objects_client.register(params: {}, assign_doi: true, user_name: 'dude')
64
64
 
65
65
  # Find object by source ID
66
66
  objects_client.find(source_id: 'sul:abc123')
@@ -84,7 +84,7 @@ background_jobs_client.show(job_id: 123)
84
84
  object_client = Dor::Services::Client.object(object_identifier)
85
85
 
86
86
  # Update an object
87
- object_client.update(params: dro)
87
+ object_client.update(params: dro, user_name: 'dude', description: 'things change sometimes')
88
88
 
89
89
  # Publish an object (push to PURL)
90
90
  object_client.publish(workflow: 'releaseWF', lane_id: 'low')
@@ -25,7 +25,8 @@ module Dor
25
25
  def start(params = {})
26
26
  body = params[:context] ? { 'context' => params[:context] }.to_json : ''
27
27
  resp = connection.post do |req|
28
- req.url with_querystring(url: path, params: params.except(:context))
28
+ req.url path
29
+ req.params = params.except(:context)
29
30
  req.headers['Content-Type'] = 'application/json'
30
31
  req.body = body
31
32
  end
@@ -29,14 +29,15 @@ module Dor
29
29
  # @param [Cocina::Models::DROWithMetadata|CollectionWithMetadata|AdminPolicyWithMetadata|DRO|Collection|AdminPolicy] params model object
30
30
  # @param [boolean] skip_lock do not provide ETag
31
31
  # @param [boolean] validate validate the response object
32
- # @param [Hash] event_data additional event data to be added to the update object event
32
+ # @param [string] user_name the sunetid of the user performing the update
33
+ # @param [string] description a description of the update
33
34
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
34
35
  # @raise [UnexpectedResponse] when the response is not successful.
35
36
  # @raise [BadRequestError] when ETag not provided.
36
37
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
37
38
  # rubocop:disable Metrics/AbcSize
38
39
  # rubocop:disable Metrics/MethodLength
39
- def update(params:, skip_lock: false, validate: false, event_data: {})
40
+ def update(params:, skip_lock: false, validate: false, user_name: nil, description: nil)
40
41
  raise ArgumentError, 'Cocina object not provided.' unless params.respond_to?(:externalIdentifier)
41
42
 
42
43
  # Raised if Cocina::Models::*WithMetadata not provided.
@@ -44,7 +45,7 @@ module Dor
44
45
 
45
46
  resp = connection.patch do |req|
46
47
  req.url object_path
47
- req.params = { event_data: event_data.to_json }
48
+ req.params = { event_description: description, user_name: user_name }.compact
48
49
  req.headers['Content-Type'] = 'application/json'
49
50
  # asking the service to return JSON (else it'll be plain text)
50
51
  req.headers['Accept'] = 'application/json'
@@ -79,10 +80,9 @@ module Dor
79
80
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
80
81
  # @raise [UnexpectedResponse] if the request is unsuccessful.
81
82
  def destroy(user_name: nil)
82
- path = object_path
83
- path += "?user_name=#{user_name}" if user_name
84
83
  resp = connection.delete do |req|
85
- req.url path
84
+ req.url object_path
85
+ req.params = { user_name: user_name }.compact
86
86
  end
87
87
  raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
88
88
 
@@ -86,7 +86,8 @@ module Dor
86
86
  # @return [Cocina::Models::DROWithMetadata|CollectionWithMetadata|AdminPolicyWithMetadata] cocina model with updated version
87
87
  def open(**params)
88
88
  resp = connection.post do |req|
89
- req.url with_querystring(url: open_new_version_path, params: params)
89
+ req.url open_new_version_path
90
+ req.params = params
90
91
  req.headers['Content-Type'] = 'application/json'
91
92
  end
92
93
 
@@ -105,7 +106,8 @@ module Dor
105
106
  # @return [String] a message confirming successful closing
106
107
  def close(**params)
107
108
  resp = connection.post do |req|
108
- req.url with_querystring(url: close_version_path, params: params)
109
+ req.url close_version_path
110
+ req.params = params
109
111
  req.headers['Content-Type'] = 'application/json'
110
112
  end
111
113
  return resp.body if resp.success?
@@ -9,12 +9,14 @@ module Dor
9
9
  class Objects < VersionedService
10
10
  # Creates a new object in DOR
11
11
  # @param params [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAdminPolicy]
12
- # @param assign_doi [Boolean]
12
+ # @param [boolean] assign a doi to the object
13
+ # @param [string] user_name the sunetid of the user registering the object
13
14
  # @param [boolean] validate validate the response object
14
15
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
15
- def register(params:, assign_doi: false, validate: false)
16
+ def register(params:, assign_doi: false, validate: false, user_name: nil)
16
17
  resp = connection.post do |req|
17
- req.url with_querystring(url: objects_path, params: { assign_doi: assign_doi })
18
+ req.url objects_path
19
+ req.params = { assign_doi: assign_doi, user_name: user_name }.compact
18
20
  req.headers['Content-Type'] = 'application/json'
19
21
  # asking the service to return JSON (else it'll be plain text)
20
22
  req.headers['Accept'] = 'application/json'
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '15.9.1'
6
+ VERSION = '15.11.0'
7
7
  end
8
8
  end
9
9
  end
@@ -25,12 +25,6 @@ module Dor
25
25
  AsyncResult.new(url: url)
26
26
  end
27
27
 
28
- def with_querystring(url:, params:)
29
- return url if params.blank?
30
-
31
- "#{url}?#{params.to_query}"
32
- end
33
-
34
28
  private
35
29
 
36
30
  attr_reader :connection, :api_version
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.9.1
4
+ version: 15.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  - Michael Giarlo
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2025-06-04 00:00:00.000000000 Z
11
+ date: 2025-06-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
@@ -207,7 +206,6 @@ dependencies:
207
206
  - - ">="
208
207
  - !ruby/object:Gem::Version
209
208
  version: '0'
210
- description:
211
209
  email:
212
210
  - jcoyne@justincoyne.com
213
211
  - leftwing@alumni.rutgers.edu
@@ -255,7 +253,6 @@ homepage: https://github.com/sul-dlss/dor-services-client
255
253
  licenses: []
256
254
  metadata:
257
255
  rubygems_mfa_required: 'true'
258
- post_install_message:
259
256
  rdoc_options: []
260
257
  require_paths:
261
258
  - lib
@@ -273,8 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
270
  - !ruby/object:Gem::Version
274
271
  version: '0'
275
272
  requirements: []
276
- rubygems_version: 3.5.11
277
- signing_key:
273
+ rubygems_version: 3.6.3
278
274
  specification_version: 4
279
275
  summary: A client for dor-services-app
280
276
  test_files: []