dor-services-client 6.0.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +3 -3
- data/README.md +3 -0
- data/lib/dor/services/client.rb +2 -0
- data/lib/dor/services/client/object.rb +19 -0
- data/lib/dor/services/client/objects.rb +1 -3
- data/lib/dor/services/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f324272fcd773616044c4ddc11f93664d52efa263f47cdcc21059dd07bee7562
|
4
|
+
data.tar.gz: 1abbe32573c71a368d69a46ce1a18c6eb587a35a6e2ad7e2dead9670e9c276a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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-
|
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:
|
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:
|
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
|
|
data/lib/dor/services/client.rb
CHANGED
@@ -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 [
|
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)
|
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.
|
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-
|
12
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|