dor-services-client 14.13.0 → 14.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -17
- data/README.md +6 -0
- data/lib/dor/services/client/user_version.rb +48 -1
- data/lib/dor/services/client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b17e776b7a8c068dd71595ca1d2e508c96b69700c87f8516f7247f4a0208f28a
|
4
|
+
data.tar.gz: 70b426fa3ac52729feb726c8c63e5907ede88b255f8095c91acfbbb9d5a8a724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de501280c3a367a9557f146ad44fe1c8a76dd408904ba6f866c3472722868b64ab650670fb9cffc6da6b06847ac723323d8436a72f77e0b27e17b4f8754ce8e8
|
7
|
+
data.tar.gz: 3783ee7eead4fc35d9305e9b88482b10708c153cf64b5ad2a695567086be641ec7e0ed9592c55dfd0369a0fadfe6f034e88fa02e29d080a0cb898b4578444a6b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
dor-services-client (14.
|
4
|
+
dor-services-client (14.14.0)
|
5
5
|
activesupport (>= 4.2, < 8)
|
6
6
|
cocina-models (~> 0.98.0)
|
7
7
|
deprecation
|
@@ -22,8 +22,8 @@ GEM
|
|
22
22
|
minitest (>= 5.1)
|
23
23
|
mutex_m
|
24
24
|
tzinfo (~> 2.0)
|
25
|
-
addressable (2.8.
|
26
|
-
public_suffix (>= 2.0.2, <
|
25
|
+
addressable (2.8.7)
|
26
|
+
public_suffix (>= 2.0.2, < 7.0)
|
27
27
|
ast (2.4.2)
|
28
28
|
attr_extras (7.1.0)
|
29
29
|
base64 (0.2.0)
|
@@ -81,7 +81,7 @@ GEM
|
|
81
81
|
activesupport (>= 3.0, < 8.0)
|
82
82
|
equivalent-xml (0.6.0)
|
83
83
|
nokogiri (>= 1.4.3)
|
84
|
-
faraday (2.9.
|
84
|
+
faraday (2.9.2)
|
85
85
|
faraday-net_http (>= 2.0, < 3.2)
|
86
86
|
faraday-net_http (3.1.0)
|
87
87
|
net-http
|
@@ -95,33 +95,33 @@ GEM
|
|
95
95
|
jsonpath (1.1.5)
|
96
96
|
multi_json
|
97
97
|
language_server-protocol (3.17.0.3)
|
98
|
-
minitest (5.
|
98
|
+
minitest (5.24.0)
|
99
99
|
multi_json (1.15.0)
|
100
100
|
mutex_m (0.2.0)
|
101
101
|
net-http (0.4.1)
|
102
102
|
uri
|
103
|
-
nokogiri (1.16.
|
103
|
+
nokogiri (1.16.6-arm64-darwin)
|
104
104
|
racc (~> 1.4)
|
105
|
-
nokogiri (1.16.
|
105
|
+
nokogiri (1.16.6-x86_64-darwin)
|
106
106
|
racc (~> 1.4)
|
107
|
-
nokogiri (1.16.
|
107
|
+
nokogiri (1.16.6-x86_64-linux)
|
108
108
|
racc (~> 1.4)
|
109
109
|
openapi3_parser (0.10.0)
|
110
110
|
commonmarker (>= 1.0)
|
111
111
|
openapi_parser (1.0.0)
|
112
112
|
optimist (3.1.0)
|
113
113
|
parallel (1.25.1)
|
114
|
-
parser (3.3.
|
114
|
+
parser (3.3.3.0)
|
115
115
|
ast (~> 2.4.1)
|
116
116
|
racc
|
117
117
|
patience_diff (1.2.0)
|
118
118
|
optimist (~> 3.0)
|
119
|
-
public_suffix (
|
119
|
+
public_suffix (6.0.0)
|
120
120
|
racc (1.8.0)
|
121
121
|
rainbow (3.1.1)
|
122
122
|
rake (13.2.1)
|
123
123
|
regexp_parser (2.9.2)
|
124
|
-
rexml (3.
|
124
|
+
rexml (3.3.0)
|
125
125
|
strscan
|
126
126
|
rspec (3.13.0)
|
127
127
|
rspec-core (~> 3.13.0)
|
@@ -129,7 +129,7 @@ GEM
|
|
129
129
|
rspec-mocks (~> 3.13.0)
|
130
130
|
rspec-core (3.13.0)
|
131
131
|
rspec-support (~> 3.13.0)
|
132
|
-
rspec-expectations (3.13.
|
132
|
+
rspec-expectations (3.13.1)
|
133
133
|
diff-lcs (>= 1.2.0, < 2.0)
|
134
134
|
rspec-support (~> 3.13.0)
|
135
135
|
rspec-mocks (3.13.1)
|
@@ -151,15 +151,15 @@ GEM
|
|
151
151
|
parser (>= 3.3.1.0)
|
152
152
|
rubocop-capybara (2.21.0)
|
153
153
|
rubocop (~> 1.41)
|
154
|
-
rubocop-factory_bot (2.26.
|
155
|
-
rubocop (~> 1.
|
154
|
+
rubocop-factory_bot (2.26.1)
|
155
|
+
rubocop (~> 1.61)
|
156
156
|
rubocop-rspec (2.31.0)
|
157
157
|
rubocop (~> 1.40)
|
158
158
|
rubocop-capybara (~> 2.17)
|
159
159
|
rubocop-factory_bot (~> 2.22)
|
160
160
|
rubocop-rspec_rails (~> 2.28)
|
161
|
-
rubocop-rspec_rails (2.29.
|
162
|
-
rubocop (~> 1.
|
161
|
+
rubocop-rspec_rails (2.29.1)
|
162
|
+
rubocop (~> 1.61)
|
163
163
|
ruby-progressbar (1.13.0)
|
164
164
|
simplecov (0.22.0)
|
165
165
|
docile (~> 1.1)
|
@@ -181,7 +181,7 @@ GEM
|
|
181
181
|
addressable (>= 2.8.0)
|
182
182
|
crack (>= 0.3.2)
|
183
183
|
hashdiff (>= 0.4.0, < 2.0.0)
|
184
|
-
zeitwerk (2.6.
|
184
|
+
zeitwerk (2.6.16)
|
185
185
|
|
186
186
|
PLATFORMS
|
187
187
|
arm64-darwin-23
|
data/README.md
CHANGED
@@ -129,6 +129,12 @@ object_client.version.open(description: 'Changed title')
|
|
129
129
|
# see dor-services-app openapi.yml for optional params
|
130
130
|
object_client.version.close
|
131
131
|
|
132
|
+
# Manage user versions
|
133
|
+
object_client.user_version.inventory
|
134
|
+
object_client.user_version.find(2)
|
135
|
+
object_client.user_version.create(object_version: 3)
|
136
|
+
object_client.user_version.update(user_version: Dor::Services::Client::UserVersion::Version.new(version: 3, userVersion: 3, withdrawn: true))
|
137
|
+
|
132
138
|
# Return the Cocina metadata
|
133
139
|
object_client.find
|
134
140
|
|
@@ -5,7 +5,7 @@ module Dor
|
|
5
5
|
class Client
|
6
6
|
# API calls that are about user versions
|
7
7
|
class UserVersion < VersionedService
|
8
|
-
Version = Struct.new(:version, :userVersion, keyword_init: true)
|
8
|
+
Version = Struct.new(:version, :userVersion, :withdrawn, keyword_init: true)
|
9
9
|
|
10
10
|
# @param object_identifier [String] the pid for the object
|
11
11
|
def initialize(connection:, version:, object_identifier:)
|
@@ -24,6 +24,53 @@ module Dor
|
|
24
24
|
JSON.parse(resp.body).fetch('user_versions').map { |params| Version.new(**params.symbolize_keys!) }
|
25
25
|
end
|
26
26
|
|
27
|
+
# @return [Cocina::Models::DROWithMetadata] the object metadata
|
28
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
29
|
+
def find(version)
|
30
|
+
resp = connection.get do |req|
|
31
|
+
req.url "#{base_path}/#{version}"
|
32
|
+
end
|
33
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
34
|
+
|
35
|
+
build_cocina_from_response(resp, validate: false)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create a user version for an object
|
39
|
+
#
|
40
|
+
# @param [String] object_version the version of the object to create a user version for
|
41
|
+
# @return [Version]
|
42
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
43
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
44
|
+
def create(object_version:)
|
45
|
+
resp = connection.post do |req|
|
46
|
+
req.url "#{api_version}/objects/#{object_identifier}/user_versions"
|
47
|
+
req.headers['Content-Type'] = 'application/json'
|
48
|
+
req.body = { version: object_version }.to_json
|
49
|
+
end
|
50
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
51
|
+
|
52
|
+
Version.new(**JSON.parse(resp.body).symbolize_keys!)
|
53
|
+
end
|
54
|
+
|
55
|
+
# Updates a user version
|
56
|
+
#
|
57
|
+
# @param [Version] user_version the updated user version
|
58
|
+
# @return [Version]
|
59
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
60
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
61
|
+
# rubocop:disable Metrics/AbcSize
|
62
|
+
def update(user_version:)
|
63
|
+
resp = connection.patch do |req|
|
64
|
+
req.url "#{api_version}/objects/#{object_identifier}/user_versions/#{user_version.userVersion}"
|
65
|
+
req.headers['Content-Type'] = 'application/json'
|
66
|
+
req.body = user_version.to_h.except(:userVersion).compact.to_json
|
67
|
+
end
|
68
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
69
|
+
|
70
|
+
Version.new(**JSON.parse(resp.body).symbolize_keys!)
|
71
|
+
end
|
72
|
+
# rubocop:enable Metrics/AbcSize
|
73
|
+
|
27
74
|
private
|
28
75
|
|
29
76
|
attr_reader :object_identifier
|
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: 14.
|
4
|
+
version: 14.14.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: 2024-06-
|
12
|
+
date: 2024-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -280,7 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
- !ruby/object:Gem::Version
|
281
281
|
version: '0'
|
282
282
|
requirements: []
|
283
|
-
rubygems_version: 3.
|
283
|
+
rubygems_version: 3.4.19
|
284
284
|
signing_key:
|
285
285
|
specification_version: 4
|
286
286
|
summary: A client for dor-services-app
|