dor-services-client 12.16.0 → 12.17.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: ec7edce5ca401aae71ab8e4b98b1b1c44c646e4565f25ba615ff8b0536ad807f
4
- data.tar.gz: faabe27c830efb9135f1d171ca6a78193ce46c5edf98455850a9d555c470e336
3
+ metadata.gz: 28239d64f9889da5c2eb01d1f7c1a724454a3f9d6e5dc04454e6d537d8b1530c
4
+ data.tar.gz: abffc94573aa3106b599477bff35c786c4ce4d6ba6bc41e9dea37dc43e8b220a
5
5
  SHA512:
6
- metadata.gz: 1150fe0e08f2ea9a6bfe9a9bb198c85e661c0cb856b4d4c50392da8c69ce478d81cbc88d6c9936f95f2cedefbe3ab147944b69764fd3b0cd52ed7761eda1ae2d
7
- data.tar.gz: 72c6d2a0c24e2cce44ead61de2f5eed38234b72fcbf75a0131e14e0c5b4126b2d0a3cbeeb69e18d614061a43f5a409791956f14cedf168c900576b6bd6b47a15
6
+ metadata.gz: 70a705670a2f0ac259b7af85806f909311d2222eb0af263d1bcbd2d96bffb0cf34185e2a9a38f4ba8cd5e1da1f3f9d1c01d4d0c490ddf29873a421d40402212e
7
+ data.tar.gz: 5ff867b49a8d5a552a6d0d5ffada7298fec9d8e19df029f8b79de2899ed1ab65b4058ddf4c0986ae99f1e6c63749bea999e3f165e3bb369416986f19e7e488ad
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (12.16.0)
4
+ dor-services-client (12.17.0)
5
5
  activesupport (>= 4.2, < 8)
6
6
  cocina-models (~> 0.91.0)
7
7
  deprecation
@@ -24,8 +24,7 @@ module Dor
24
24
  # @raise [UnexpectedResponse] when the response is not successful.
25
25
  def start(params = {})
26
26
  resp = connection.post do |req|
27
- req.url path
28
- req.params = params
27
+ req.url with_querystring(url: path, params: params)
29
28
  end
30
29
  return true if resp.success?
31
30
 
@@ -59,9 +59,8 @@ module Dor
59
59
  # @return [Cocina::Models::DROWithMetadata|CollectionWithMetadata|AdminPolicyWithMetadata] cocina model with updated version
60
60
  def open(**params)
61
61
  resp = connection.post do |req|
62
- req.url open_new_version_path
62
+ req.url with_querystring(url: open_new_version_path, params: params)
63
63
  req.headers['Content-Type'] = 'application/json'
64
- req.body = params.to_json if params.any?
65
64
  end
66
65
 
67
66
  raise_exception_based_on_response!(resp) unless resp.success?
@@ -79,9 +78,8 @@ module Dor
79
78
  # @return [String] a message confirming successful closing
80
79
  def close(**params)
81
80
  resp = connection.post do |req|
82
- req.url close_version_path
81
+ req.url with_querystring(url: close_version_path, params: params)
83
82
  req.headers['Content-Type'] = 'application/json'
84
- req.body = params.to_json if params.any?
85
83
  end
86
84
  return resp.body if resp.success?
87
85
 
@@ -14,11 +14,10 @@ module Dor
14
14
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
15
15
  def register(params:, assign_doi: false, validate: false)
16
16
  resp = connection.post do |req|
17
- req.url objects_path
17
+ req.url with_querystring(url: objects_path, params: { assign_doi: assign_doi })
18
18
  req.headers['Content-Type'] = 'application/json'
19
19
  # asking the service to return JSON (else it'll be plain text)
20
20
  req.headers['Accept'] = 'application/json'
21
- req.params[:assign_doi] = true if assign_doi
22
21
  req.body = params.to_json
23
22
  end
24
23
 
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '12.16.0'
6
+ VERSION = '12.17.0'
7
7
  end
8
8
  end
9
9
  end
@@ -25,6 +25,12 @@ 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
+
28
34
  private
29
35
 
30
36
  attr_reader :connection, :api_version
@@ -5,6 +5,7 @@ require 'active_support/core_ext/module/delegation'
5
5
  require 'active_support/core_ext/object/blank'
6
6
  require 'active_support/json'
7
7
  require 'active_support/core_ext/object/json'
8
+ require 'active_support/core_ext/object/to_query'
8
9
  require 'cocina/models'
9
10
  require 'faraday'
10
11
  require 'faraday/retry'
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: 12.16.0
4
+ version: 12.17.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: 2023-09-11 00:00:00.000000000 Z
12
+ date: 2023-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport