dor-services-client 14.13.0 → 14.15.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 +18 -18
- data/README.md +7 -0
- data/lib/dor/services/client/user_version.rb +59 -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: f2b55c7474fab7b39f9c192e3effa26056d8523e8d319a5915b205d242ae4edf
|
4
|
+
data.tar.gz: f15fdecc7e97287f58a6e386a4b94f8ba466f5db6d95e5f763ef773852ded901
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 324c792ac506b0e4fdd0ff750c6348864bd116a0881dc02ebc657a0ca8ccceeed236c529a36cbf9bfdaedd0261363d5b69e9d5a9526fcfd3116ba29ad34486e1
|
7
|
+
data.tar.gz: 5aa5c984f0e3815bcb30b39b09292c9b7965113264e26c987d73cc0cbf3e8fe7e94906bb5d1395666da053d4bbde7ef48c3c8fd7611f41dd120e37438b008b1a
|
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.15.0)
|
5
5
|
activesupport (>= 4.2, < 8)
|
6
6
|
cocina-models (~> 0.98.0)
|
7
7
|
deprecation
|
@@ -22,14 +22,14 @@ 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)
|
30
30
|
bigdecimal (3.1.8)
|
31
31
|
byebug (11.1.3)
|
32
|
-
cocina-models (0.98.
|
32
|
+
cocina-models (0.98.1)
|
33
33
|
activesupport
|
34
34
|
deprecation
|
35
35
|
dry-struct (~> 1.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.1)
|
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.1)
|
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,13 @@ 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.solr(2)
|
136
|
+
object_client.user_version.create(object_version: 3)
|
137
|
+
object_client.user_version.update(user_version: Dor::Services::Client::UserVersion::Version.new(version: 3, userVersion: 3, withdrawn: true))
|
138
|
+
|
132
139
|
# Return the Cocina metadata
|
133
140
|
object_client.find
|
134
141
|
|
@@ -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,64 @@ 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
|
+
# @return [Hash] the solr document for the user version
|
39
|
+
# @raise [UnexpectedResponse] on an unsuccessful response from the server
|
40
|
+
def solr(version)
|
41
|
+
resp = connection.get do |req|
|
42
|
+
req.url "#{base_path}/#{version}/solr"
|
43
|
+
end
|
44
|
+
raise_exception_based_on_response!(resp) unless resp.success?
|
45
|
+
|
46
|
+
JSON.parse(resp.body)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Create a user version for an object
|
50
|
+
#
|
51
|
+
# @param [String] object_version the version of the object to create a user version for
|
52
|
+
# @return [Version]
|
53
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
54
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
55
|
+
def create(object_version:)
|
56
|
+
resp = connection.post do |req|
|
57
|
+
req.url "#{api_version}/objects/#{object_identifier}/user_versions"
|
58
|
+
req.headers['Content-Type'] = 'application/json'
|
59
|
+
req.body = { version: object_version }.to_json
|
60
|
+
end
|
61
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
62
|
+
|
63
|
+
Version.new(**JSON.parse(resp.body).symbolize_keys!)
|
64
|
+
end
|
65
|
+
|
66
|
+
# Updates a user version
|
67
|
+
#
|
68
|
+
# @param [Version] user_version the updated user version
|
69
|
+
# @return [Version]
|
70
|
+
# @raise [NotFoundResponse] when the response is a 404 (object not found)
|
71
|
+
# @raise [UnexpectedResponse] if the request is unsuccessful.
|
72
|
+
# rubocop:disable Metrics/AbcSize
|
73
|
+
def update(user_version:)
|
74
|
+
resp = connection.patch do |req|
|
75
|
+
req.url "#{api_version}/objects/#{object_identifier}/user_versions/#{user_version.userVersion}"
|
76
|
+
req.headers['Content-Type'] = 'application/json'
|
77
|
+
req.body = user_version.to_h.except(:userVersion).compact.to_json
|
78
|
+
end
|
79
|
+
raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
|
80
|
+
|
81
|
+
Version.new(**JSON.parse(resp.body).symbolize_keys!)
|
82
|
+
end
|
83
|
+
# rubocop:enable Metrics/AbcSize
|
84
|
+
|
27
85
|
private
|
28
86
|
|
29
87
|
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.15.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-
|
12
|
+
date: 2024-07-03 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
|