dor-services-client 15.69.0 → 15.71.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: f7eb1b5eb6201610e9bd4496dcc0709e4a3348639aae0655c25373b98d00c621
4
- data.tar.gz: f45e73e423f64393198f41d2ef7f4d954bc0794b470aea4e7b647e2f37cd2e01
3
+ metadata.gz: 730aef635e88c59d2124afc5c4a14bec8e5a1b6bc73e76726a647be01a97a420
4
+ data.tar.gz: 8f0b4402c3a91a00d186e15c0360d248f9f53363605702046919cba80b3ec091
5
5
  SHA512:
6
- metadata.gz: ba12e822c3fcbd54f30d140ed114ee680854580b00a9632aa77b6f1081ca31258693836f4b5b325e18bfde34c38c3055cd81c6e4cc6f7c18ceb76de03403ac50
7
- data.tar.gz: 5d825bc8d170005932dcd7d9d104c43ad7a3560aa6e99673c245fa6abbf1de01993286cef5aeb4930ea297db304fa88db58a5bd6ea6b6bd6d2deb595e51869d3
6
+ metadata.gz: 914ba382636b58b9d0a257066b5c1d7a60cc94155157d1d5fad943d340750f66d04d04c3b61d0b74d8bcdf1310eb21dcb3eea004ac752da5cdd077eca63d8033
7
+ data.tar.gz: eb7e38f3a6ff299338a4178378c9aad9cff096dcf4fe68f260794fddae36422b930634ea4ff3ccf4d1d2ae0c5c8ade4d74cecfdef7a87a9e1da7888253230be7
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@4.13.1
3
+ ruby-rails: sul-dlss/ruby-rails@5.0.0
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/.rubocop.yml CHANGED
@@ -4,9 +4,14 @@ plugins:
4
4
  - rubocop-rspec
5
5
 
6
6
  AllCops:
7
- TargetRubyVersion: 3.0
7
+ TargetRubyVersion: 4.0
8
8
  SuggestExtensions: false
9
9
 
10
+ # Development uses Ruby 4, but the gem still supports older consumers.
11
+ Gemspec/RequiredRubyVersion:
12
+ Exclude:
13
+ - dor-services-client.gemspec
14
+
10
15
  Metrics/BlockLength:
11
16
  Exclude:
12
17
  - 'dor-services-client.gemspec'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (15.69.0)
4
+ dor-services-client (15.71.0)
5
5
  activesupport (>= 7.0.0)
6
6
  cocina-models (~> 0.133.0)
7
7
  deprecation
@@ -27,7 +27,7 @@ GEM
27
27
  securerandom (>= 0.3)
28
28
  tzinfo (~> 2.0, >= 2.0.5)
29
29
  uri (>= 0.13.1)
30
- addressable (2.9.0)
30
+ addressable (2.9.2)
31
31
  public_suffix (>= 2.0.2, < 8.0)
32
32
  ast (2.4.3)
33
33
  attr_extras (7.1.0)
@@ -49,7 +49,7 @@ GEM
49
49
  super_diff
50
50
  thor
51
51
  zeitwerk (~> 2.1)
52
- cocina_display (2.13.0)
52
+ cocina_display (2.14.0)
53
53
  activesupport (>= 7)
54
54
  edtf (~> 3.2)
55
55
  geo_coord (~> 0.2)
@@ -92,30 +92,30 @@ GEM
92
92
  activesupport (>= 3.0, < 9.0)
93
93
  equivalent-xml (0.6.0)
94
94
  nokogiri (>= 1.4.3)
95
- faraday (2.14.4)
96
- faraday-net_http (>= 2.0, < 3.5)
95
+ faraday (2.15.1)
96
+ faraday-net_http (>= 2.0, < 3.6)
97
97
  json
98
98
  logger
99
- faraday-net_http (3.4.4)
99
+ faraday-net_http (3.5.0)
100
100
  net-http (~> 0.5)
101
101
  faraday-retry (2.4.0)
102
102
  faraday (~> 2.0)
103
103
  geo_coord (0.2.0)
104
104
  hashdiff (1.2.1)
105
- hashie (5.1.0)
105
+ hashie (5.2.0)
106
106
  logger
107
107
  i18n (1.15.2)
108
108
  concurrent-ruby (~> 1.0)
109
109
  ice_nine (0.11.2)
110
- io-console (0.9.4)
110
+ io-console (0.9.5)
111
111
  iso8601 (0.13.0)
112
- janeway-jsonpath (1.1.0)
113
- json (3.0.2)
114
- jsonschema_rs (0.58.5-arm64-darwin)
112
+ janeway-jsonpath (1.2.0)
113
+ json (3.1.0)
114
+ jsonschema_rs (0.60.2-arm64-darwin)
115
115
  bigdecimal (>= 3.1, < 5)
116
- jsonschema_rs (0.58.5-x86_64-darwin)
116
+ jsonschema_rs (0.60.2-x86_64-darwin)
117
117
  bigdecimal (>= 3.1, < 5)
118
- jsonschema_rs (0.58.5-x86_64-linux)
118
+ jsonschema_rs (0.60.2-x86_64-linux)
119
119
  bigdecimal (>= 3.1, < 5)
120
120
  language_server-protocol (3.17.0.6)
121
121
  lint_roller (1.1.0)
@@ -123,17 +123,20 @@ GEM
123
123
  minitest (6.0.6)
124
124
  drb (~> 2.0)
125
125
  prism (~> 1.5)
126
- net-http (0.9.1)
126
+ net-http (0.10.0)
127
+ net-protocol (>= 0.3.0)
127
128
  uri (>= 0.11.1)
128
- nokogiri (1.19.4-arm64-darwin)
129
+ net-protocol (0.4.0)
130
+ timeout
131
+ nokogiri (1.19.6-arm64-darwin)
129
132
  racc (~> 1.4)
130
- nokogiri (1.19.4-x86_64-darwin)
133
+ nokogiri (1.19.6-x86_64-darwin)
131
134
  racc (~> 1.4)
132
- nokogiri (1.19.4-x86_64-linux-gnu)
135
+ nokogiri (1.19.6-x86_64-linux-gnu)
133
136
  racc (~> 1.4)
134
137
  optimist (3.2.1)
135
138
  parallel (2.3.0)
136
- parser (3.3.12.0)
139
+ parser (3.3.13.0)
137
140
  ast (~> 2.4.1)
138
141
  racc
139
142
  patience_diff (1.2.0)
@@ -160,14 +163,14 @@ GEM
160
163
  diff-lcs (>= 1.2.0, < 2.0)
161
164
  rspec-support (~> 3.13.0)
162
165
  rspec-support (3.13.7)
163
- rubocop (1.91.0)
166
+ rubocop (1.92.2)
164
167
  json (>= 2.3)
165
168
  language_server-protocol (~> 3.17.0.2)
166
169
  lint_roller (~> 1.1.0)
167
170
  parallel (>= 1.10)
168
171
  parser (>= 3.3.0.2)
169
172
  rainbow (>= 2.2.2, < 4.0)
170
- regexp_parser (>= 2.9.3, < 3.0)
173
+ regexp_parser (>= 2.11.3, < 3.0)
171
174
  rubocop-ast (>= 1.49.0, < 2.0)
172
175
  ruby-progressbar (~> 1.7)
173
176
  unicode-display_width (>= 2.4.0, < 4.0)
@@ -186,13 +189,14 @@ GEM
186
189
  diff-lcs (~> 1.5)
187
190
  patience_diff (~> 1.2)
188
191
  thor (1.5.0)
192
+ timeout (0.6.1)
189
193
  tzinfo (2.0.6)
190
194
  concurrent-ruby (~> 1.0)
191
195
  unicode-display_width (3.3.0)
192
196
  unicode-emoji (~> 4.3)
193
197
  unicode-emoji (4.3.0)
194
- uri (1.1.1)
195
- webmock (3.26.4)
198
+ uri (1.1.2)
199
+ webmock (3.34.0)
196
200
  addressable (>= 2.8.0)
197
201
  crack (>= 0.3.2)
198
202
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -220,4 +224,4 @@ DEPENDENCIES
220
224
  webmock
221
225
 
222
226
  BUNDLED WITH
223
- 4.0.22
227
+ 4.0.23
data/README.md CHANGED
@@ -132,8 +132,13 @@ object_client.user_version.create(object_version: 3)
132
132
  object_client.user_version.update(user_version: Dor::Services::Client::UserVersion::Version.new(version: 3, userVersion: 3, withdrawn: true))
133
133
 
134
134
  # Return the Cocina metadata
135
+ # Raises Dor::Services::Client::InvalidCocinaError if the stored cocina is invalid.
135
136
  object_client.find
136
137
 
138
+ # Return the Cocina metadata without the file sets (structural.contains), e.g., for objects with many files.
139
+ # Don't use the returned object for an update, which would remove its files.
140
+ object_client.find(without_structural_contains: true)
141
+
137
142
  # Returns "lite" Cocina metadata (excluding specified attributes)
138
143
  object_client.find_lite(structural: false, geographic: false)
139
144
 
@@ -169,7 +174,7 @@ object_client.events.list(event_types: ['version_open', 'version_close'])
169
174
  object_client.events.list(from: '2026-10-01', to: Time.now)
170
175
 
171
176
  # Create workspaces
172
- object_client.workspace.create(source: object_path_string)
177
+ object_client.workspace.create(content: true, metadata: true)
173
178
 
174
179
  # Reindex
175
180
  object_client.reindex
@@ -231,6 +236,8 @@ result.errors
231
236
 
232
237
  ## Development
233
238
 
239
+ Use Ruby 4.0.7 for development and testing.
240
+
234
241
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
235
242
 
236
243
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
@@ -68,12 +68,15 @@ module Dor
68
68
 
69
69
  # Retrieves the Cocina model
70
70
  # @param [boolean] validate validate the response object
71
+ # @param [boolean] without_structural_contains omit the file sets (structural.contains), e.g., for objects
72
+ # with many files. The returned model must not be used for an update, which would remove its files.
71
73
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
72
74
  # @raise [UnexpectedResponse] when the response is not successful.
73
75
  # @return [Cocina::Models::DROWithMetadata,Cocina::Models::CollectionWithMetadata,Cocina::Models::AdminPolicyWithMetadata] the returned model
74
- def find(validate: false)
76
+ def find(validate: false, without_structural_contains: false)
75
77
  resp = connection.get do |req|
76
78
  req.url object_path
79
+ req.params['without_structural_contains'] = true if without_structural_contains
77
80
  end
78
81
  raise_exception_based_on_response!(resp) unless resp.success?
79
82
 
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '15.69.0'
6
+ VERSION = '15.71.0'
7
7
  end
8
8
  end
9
9
  end
@@ -16,6 +16,9 @@ module Dor
16
16
 
17
17
  JSON_API_MIME_TYPE = 'application/vnd.api+json'
18
18
 
19
+ # Title of the JSON:API error dor-services-app returns when stored cocina is invalid
20
+ INVALID_COCINA_TITLE = 'Invalid cocina'
21
+
19
22
  def initialize(connection:, version:)
20
23
  @connection = connection
21
24
  @api_version = version
@@ -36,10 +39,16 @@ module Dor
36
39
  else
37
40
  {}
38
41
  end
39
- exception_class = EXCEPTION_CLASS.fetch(response.status, UnexpectedResponse)
40
- raise exception_class.new(response: response,
41
- object_identifier: object_identifier,
42
- errors: data.fetch('errors', []))
42
+ errors = data.fetch('errors', [])
43
+ raise exception_class_for(response.status, errors).new(response: response,
44
+ object_identifier: object_identifier,
45
+ errors: errors)
46
+ end
47
+
48
+ def exception_class_for(status, errors)
49
+ return InvalidCocinaError if status == 500 && errors.first&.dig('title') == INVALID_COCINA_TITLE
50
+
51
+ EXCEPTION_CLASS.fetch(status, UnexpectedResponse)
43
52
  end
44
53
 
45
54
  def build_cocina_from_response(item, headers: nil, validate: false)
@@ -12,16 +12,13 @@ module Dor
12
12
  end
13
13
 
14
14
  # Initializes a new workspace
15
- # @param source [String] the path to the object (optional)
16
15
  # @param content [Boolean] determines if the content directory should be created (defaults to false)
17
16
  # @param metadata [Boolean] determines if the metadata directory should be created (defaults to false)
18
17
  # @raise [UnexpectedResponse] if the request is unsuccessful.
19
18
  # @return [String] the path to the directory created
20
- # rubocop:disable Metrics/AbcSize
21
- def create(source: nil, content: false, metadata: false)
19
+ def create(content: false, metadata: false)
22
20
  resp = connection.post do |req|
23
21
  req.url workspace_path
24
- req.params['source'] = source if source
25
22
  req.params['content'] = content
26
23
  req.params['metadata'] = metadata
27
24
  end
@@ -29,7 +26,6 @@ module Dor
29
26
 
30
27
  raise_exception_based_on_response!(resp, object_identifier) unless resp.success?
31
28
  end
32
- # rubocop:enable Metrics/AbcSize
33
29
 
34
30
  private
35
31
 
@@ -84,6 +84,9 @@ module Dor
84
84
  # This occurs when the request is well-formed but the content is not indexable
85
85
  class UnprocessableContentError < UnexpectedResponse; end
86
86
 
87
+ # Error that is raised when dor-services-app returns a 500 because the stored cocina is invalid
88
+ class InvalidCocinaError < UnexpectedResponse; end
89
+
87
90
  module Types
88
91
  include Dry.Types()
89
92
  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: 15.69.0
4
+ version: 15.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne