dor-services-client 6.0.0 → 6.1.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: 9a9be29831acec973c17629c2fb21b738a582cb8aa7f02c1d0d83f315bd55316
4
- data.tar.gz: 24d3dd35eb18bb642a705239dccfe233e53456b345b89d1db6b5bc34a7c4fd16
3
+ metadata.gz: f324272fcd773616044c4ddc11f93664d52efa263f47cdcc21059dd07bee7562
4
+ data.tar.gz: 1abbe32573c71a368d69a46ce1a18c6eb587a35a6e2ad7e2dead9670e9c276a5
5
5
  SHA512:
6
- metadata.gz: 7a09583c6ac09ca1e10e19ff9818f52c7dce86aea420b4b4ff110c32be77441b208fa2e9fd8eb0823106830cbf635b68f34fd1b990e6c57b18117f901a2276e9
7
- data.tar.gz: a89da92b5802aba7d440b369a9b728a3d6ab4cf7c667036495d9d3bf2a7cbd3a8390e09d5bc06414f120a3ccc66a95b625e08e20fe2e7569208c1b2d718a745b
6
+ metadata.gz: ece82eaa29c075d3e6b5c66d18e133f200984c7ef0ab5cdb810ed11e729de893fe8be0e5610a67452dd6fbc5cb0264e9aa6983f8d3d342926e04c9ad45a39b33
7
+ data.tar.gz: 906962b8dabe3ebb34fab6a41ffa8dd52e5c1e68315587d3763a8897cf3d2fd182929d3cd3b1e9e58de6e988415ddd351071e44ee3bcaf42cafde272e1d35269
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-04-21 15:28:36 -0400 using RuboCop version 0.82.0.
3
+ # on 2020-04-23 17:01:17 -0400 using RuboCop version 0.82.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -14,7 +14,7 @@ Metrics/AbcSize:
14
14
  # Offense count: 1
15
15
  # Configuration parameters: CountComments.
16
16
  Metrics/ClassLength:
17
- Max: 103
17
+ Max: 113
18
18
 
19
19
  # Offense count: 1
20
20
  # Configuration parameters: CountComments, ExcludedMethods.
@@ -28,7 +28,7 @@ Style/Documentation:
28
28
  - 'test/**/*'
29
29
  - 'lib/dor/services/client.rb'
30
30
 
31
- # Offense count: 334
31
+ # Offense count: 338
32
32
  # Cop supports --auto-correct.
33
33
  # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
34
34
  # URISchemes: http, https
data/README.md CHANGED
@@ -84,6 +84,9 @@ marcxml_client.marcxml(catkey: '987654321')
84
84
  # For performing operations on a known, registered object
85
85
  object_client = Dor::Services::Client.object(object_identifier)
86
86
 
87
+ # Update an object
88
+ object_client.update(params: dro)
89
+
87
90
  # Publish an object (push to PURL)
88
91
  object_client.publish(workflow: 'releaseWF', lane_id: 'low')
89
92
 
@@ -3,6 +3,8 @@
3
3
  require 'active_support/core_ext/hash/indifferent_access'
4
4
  require 'active_support/core_ext/module/delegation'
5
5
  require 'active_support/core_ext/object/blank'
6
+ require 'active_support/json'
7
+ require 'active_support/core_ext/object/json'
6
8
  require 'cocina/models'
7
9
  require 'faraday'
8
10
  require 'singleton'
@@ -65,6 +65,25 @@ module Dor
65
65
  raise_exception_based_on_response!(resp)
66
66
  end
67
67
 
68
+ # Updates the object
69
+ # @param [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] params model object
70
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
71
+ # @raise [UnexpectedResponse] when the response is not successful.
72
+ # @return [Cocina::Models::DRO,Cocina::Models::Collection,Cocina::Models::AdminPolicy] the returned model
73
+ def update(params:)
74
+ resp = connection.patch do |req|
75
+ req.url object_path
76
+ req.headers['Content-Type'] = 'application/json'
77
+ # asking the service to return JSON (else it'll be plain text)
78
+ req.headers['Accept'] = 'application/json'
79
+ req.body = params.to_json
80
+ end
81
+
82
+ return Cocina::Models.build(JSON.parse(resp.body)) if resp.success?
83
+
84
+ raise_exception_based_on_response!(resp)
85
+ end
86
+
68
87
  # Get a list of the collections. (Similar to Valkyrie's find_inverse_references_by)
69
88
  # @raise [UnexpectedResponse] if the request is unsuccessful.
70
89
  # @return [Array<Cocina::Models::DRO>]
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'deprecation'
4
- require 'active_support/json'
5
- require 'active_support/core_ext/object/json'
6
4
 
7
5
  module Dor
8
6
  module Services
@@ -11,7 +9,7 @@ module Dor
11
9
  class Objects < VersionedService
12
10
  # Creates a new object in DOR
13
11
  # @param [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO]
14
- # @return [HashWithIndifferentAccess] the response, which includes a :pid
12
+ # @return [Cocina::Models::RequestDRO,Cocina::Models::RequestCollection,Cocina::Models::RequestAPO] the returned model
15
13
  def register(params:)
16
14
  json_str = register_response(params: params)
17
15
  json = JSON.parse(json_str)
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '6.0.0'
6
+ VERSION = '6.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: 6.0.0
4
+ version: 6.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: 2020-04-24 00:00:00.000000000 Z
12
+ date: 2020-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport