dor-services-client 14.12.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 +28 -28
- data/README.md +6 -0
- data/dor-services-client.gemspec +1 -1
- data/lib/dor/services/client/user_version.rb +48 -1
- data/lib/dor/services/client/version.rb +1 -1
- metadata +5 -5
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,9 +1,9 @@
|
|
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
|
-
cocina-models (~> 0.
|
6
|
+
cocina-models (~> 0.98.0)
|
7
7
|
deprecation
|
8
8
|
faraday (~> 2.0)
|
9
9
|
faraday-retry
|
@@ -12,7 +12,7 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (7.1.3.
|
15
|
+
activesupport (7.1.3.4)
|
16
16
|
base64
|
17
17
|
bigdecimal
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
@@ -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.
|
32
|
+
cocina-models (0.98.0)
|
33
33
|
activesupport
|
34
34
|
deprecation
|
35
35
|
dry-struct (~> 1.0)
|
@@ -44,10 +44,10 @@ GEM
|
|
44
44
|
super_diff
|
45
45
|
thor
|
46
46
|
zeitwerk (~> 2.1)
|
47
|
-
commonmarker (1.1.
|
48
|
-
commonmarker (1.1.
|
49
|
-
commonmarker (1.1.
|
50
|
-
concurrent-ruby (1.3.
|
47
|
+
commonmarker (1.1.4-arm64-darwin)
|
48
|
+
commonmarker (1.1.4-x86_64-darwin)
|
49
|
+
commonmarker (1.1.4-x86_64-linux)
|
50
|
+
concurrent-ruby (1.3.3)
|
51
51
|
connection_pool (2.4.1)
|
52
52
|
crack (1.0.0)
|
53
53
|
bigdecimal
|
@@ -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,41 +95,41 @@ 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
|
-
parallel (1.
|
114
|
-
parser (3.3.
|
113
|
+
parallel (1.25.1)
|
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.
|
125
|
-
strscan
|
124
|
+
rexml (3.3.0)
|
125
|
+
strscan
|
126
126
|
rspec (3.13.0)
|
127
127
|
rspec-core (~> 3.13.0)
|
128
128
|
rspec-expectations (~> 3.13.0)
|
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)
|
@@ -149,17 +149,17 @@ GEM
|
|
149
149
|
unicode-display_width (>= 2.4.0, < 3.0)
|
150
150
|
rubocop-ast (1.31.3)
|
151
151
|
parser (>= 3.3.1.0)
|
152
|
-
rubocop-capybara (2.
|
152
|
+
rubocop-capybara (2.21.0)
|
153
153
|
rubocop (~> 1.41)
|
154
|
-
rubocop-factory_bot (2.
|
155
|
-
rubocop (~> 1.
|
156
|
-
rubocop-rspec (2.
|
154
|
+
rubocop-factory_bot (2.26.1)
|
155
|
+
rubocop (~> 1.61)
|
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.
|
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
|
|
data/dor-services-client.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = '>= 3.0', '< 4'
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '>= 4.2', '< 8'
|
28
|
-
spec.add_dependency 'cocina-models', '~> 0.
|
28
|
+
spec.add_dependency 'cocina-models', '~> 0.98.0'
|
29
29
|
spec.add_dependency 'deprecation', '>= 0'
|
30
30
|
spec.add_dependency 'faraday', '~> 2.0'
|
31
31
|
spec.add_dependency 'faraday-retry'
|
@@ -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
|
@@ -37,14 +37,14 @@ dependencies:
|
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.98.0
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.98.0
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: deprecation
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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
|