dor-services-client 15.23.0 → 15.25.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: ee39ccef3d9ebbaca1274100a313c7529e03c14838ec30b10119471c6f8d6525
4
- data.tar.gz: 69ba413ab69ba15c74938606fba781de8f3299b94e6d3d1cddef8b1394d9bc65
3
+ metadata.gz: 739ccdbddf9ca107fea26b7188c6be70d01ad4c85100a9261c8c6430fa409afe
4
+ data.tar.gz: 839771682653bdc43b40073390af665c87b20d9b624ba006e1623b090144b35e
5
5
  SHA512:
6
- metadata.gz: 3cade125db7720a1a041b45b5c4394d9bc7c073d0e8ec531229be0d0876e2b604cc7d79e41075f60237d962c69030c416e50146de1e8a3e9ea5b6c64eb48e851
7
- data.tar.gz: e8a1f5774e98fc5a782538962896610c746b2f68dd02128db9934039d5e4d21555397e5195ae9c2047002994a67c782cd8d2fb0002d3221ac4ca54a3418c5a0a
6
+ metadata.gz: f3867caade7cbf123c47e4f196d74c52433fcd1876e9ae4b33a9f0ba33d072f1bf3eabc3f26d0ceed99c03697f8d8746a1f1ff424141bc47db471474e1188cd1
7
+ data.tar.gz: f55887665882f769f8b4fa7a8049812b8ebeea013621bd0dd341df1ccdb7bd3352a71e8c3052a39c1ca427bcfcc94ff1a629d3458c884b46d982d0ed0c558ce1
data/.rubocop.yml CHANGED
@@ -346,3 +346,30 @@ Style/RedundantFormat: # new in 1.72
346
346
  Enabled: true
347
347
  Style/SafeNavigationChainLength: # new in 1.68
348
348
  Enabled: true
349
+
350
+ Gemspec/AttributeAssignment: # new in 1.77
351
+ Enabled: true
352
+ Layout/EmptyLinesAfterModuleInclusion: # new in 1.79
353
+ Enabled: true
354
+ Lint/UselessDefaultValueArgument: # new in 1.76
355
+ Enabled: true
356
+ Lint/UselessOr: # new in 1.76
357
+ Enabled: true
358
+ Naming/PredicateMethod: # new in 1.76
359
+ Enabled: false
360
+ Style/ArrayIntersectWithSingleElement: # new in 1.81
361
+ Enabled: true
362
+ Style/CollectionQuerying: # new in 1.77
363
+ Enabled: true
364
+ Style/ComparableBetween: # new in 1.74
365
+ Enabled: true
366
+ Style/EmptyStringInsideInterpolation: # new in 1.76
367
+ Enabled: true
368
+ Style/HashFetchChain: # new in 1.75
369
+ Enabled: true
370
+ Style/ItBlockParameter: # new in 1.75
371
+ Enabled: true
372
+ Style/RedundantArrayFlatten: # new in 1.76
373
+ Enabled: true
374
+ RSpec/IncludeExamples: # new in 3.6
375
+ Enabled: true
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (15.23.0)
4
+ dor-services-client (15.25.0)
5
5
  activesupport (>= 7.0.0)
6
- cocina-models (~> 0.107.0)
6
+ cocina-models (~> 0.108.0)
7
7
  deprecation
8
8
  faraday (~> 2.0)
9
9
  faraday-retry
@@ -13,14 +13,14 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (8.0.3)
16
+ activesupport (8.1.0)
17
17
  base64
18
- benchmark (>= 0.3)
19
18
  bigdecimal
20
19
  concurrent-ruby (~> 1.0, >= 1.3.1)
21
20
  connection_pool (>= 2.2.5)
22
21
  drb
23
22
  i18n (>= 1.6, < 2)
23
+ json
24
24
  logger (>= 1.4.2)
25
25
  minitest (>= 5.1)
26
26
  securerandom (>= 0.3)
@@ -31,10 +31,9 @@ GEM
31
31
  ast (2.4.3)
32
32
  attr_extras (7.1.0)
33
33
  base64 (0.3.0)
34
- benchmark (0.4.1)
35
- bigdecimal (3.2.3)
34
+ bigdecimal (3.3.1)
36
35
  byebug (12.0.0)
37
- cocina-models (0.107.0)
36
+ cocina-models (0.108.0)
38
37
  activesupport
39
38
  deprecation
40
39
  dry-struct (~> 1.0)
@@ -50,7 +49,7 @@ GEM
50
49
  zeitwerk (~> 2.1)
51
50
  concurrent-ruby (1.3.5)
52
51
  connection_pool (2.5.4)
53
- crack (1.0.0)
52
+ crack (1.0.1)
54
53
  bigdecimal
55
54
  rexml
56
55
  deprecation (1.1.0)
@@ -96,13 +95,13 @@ GEM
96
95
  i18n (1.14.7)
97
96
  concurrent-ruby (~> 1.0)
98
97
  ice_nine (0.11.2)
99
- json (2.15.0)
98
+ json (2.15.2)
100
99
  jsonpath (1.1.5)
101
100
  multi_json
102
101
  language_server-protocol (3.17.0.5)
103
102
  lint_roller (1.1.0)
104
103
  logger (1.7.0)
105
- minitest (5.25.5)
104
+ minitest (5.26.0)
106
105
  multi_json (1.17.0)
107
106
  net-http (0.6.0)
108
107
  uri
@@ -115,32 +114,32 @@ GEM
115
114
  openapi_parser (1.0.0)
116
115
  optimist (3.2.1)
117
116
  parallel (1.27.0)
118
- parser (3.3.9.0)
117
+ parser (3.3.10.0)
119
118
  ast (~> 2.4.1)
120
119
  racc
121
120
  patience_diff (1.2.0)
122
121
  optimist (~> 3.0)
123
- prism (1.5.1)
122
+ prism (1.6.0)
124
123
  public_suffix (6.0.2)
125
124
  racc (1.8.1)
126
125
  rainbow (3.1.1)
127
126
  rake (13.3.0)
128
127
  regexp_parser (2.11.3)
129
128
  rexml (3.4.4)
130
- rspec (3.13.1)
129
+ rspec (3.13.2)
131
130
  rspec-core (~> 3.13.0)
132
131
  rspec-expectations (~> 3.13.0)
133
132
  rspec-mocks (~> 3.13.0)
134
- rspec-core (3.13.5)
133
+ rspec-core (3.13.6)
135
134
  rspec-support (~> 3.13.0)
136
135
  rspec-expectations (3.13.5)
137
136
  diff-lcs (>= 1.2.0, < 2.0)
138
137
  rspec-support (~> 3.13.0)
139
- rspec-mocks (3.13.5)
138
+ rspec-mocks (3.13.6)
140
139
  diff-lcs (>= 1.2.0, < 2.0)
141
140
  rspec-support (~> 3.13.0)
142
141
  rspec-support (3.13.6)
143
- rubocop (1.81.1)
142
+ rubocop (1.81.6)
144
143
  json (~> 2.3)
145
144
  language_server-protocol (~> 3.17.0.2)
146
145
  lint_roller (~> 1.1.0)
@@ -165,7 +164,7 @@ GEM
165
164
  simplecov_json_formatter (~> 0.1)
166
165
  simplecov-html (0.13.2)
167
166
  simplecov_json_formatter (0.1.4)
168
- super_diff (0.16.0)
167
+ super_diff (0.17.0)
169
168
  attr_extras (>= 6.2.4)
170
169
  diff-lcs
171
170
  patience_diff
@@ -175,8 +174,8 @@ GEM
175
174
  unicode-display_width (3.2.0)
176
175
  unicode-emoji (~> 4.1)
177
176
  unicode-emoji (4.1.0)
178
- uri (1.0.3)
179
- webmock (3.25.1)
177
+ uri (1.0.4)
178
+ webmock (3.26.0)
180
179
  addressable (>= 2.8.0)
181
180
  crack (>= 0.3.2)
182
181
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.md CHANGED
@@ -68,6 +68,9 @@ objects_client.find(source_id: 'sul:abc123')
68
68
  # Get status for a batch of objects
69
69
  objects_client.statuses(object_ids: ['druid:bc123df4567', 'druid:bc987gh6543'])
70
70
 
71
+ # Determine if a cocina representation will index to solr
72
+ objects_client.indexable(druid: 'druid:bc123df4567', cocina: cocina_object)
73
+
71
74
  # Interact with virtual objects
72
75
  virtual_objects_client = Dor::Services::Client.virtual_objects
73
76
 
@@ -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', '>= 7.0.0'
28
- spec.add_dependency 'cocina-models', '~> 0.107.0'
28
+ spec.add_dependency 'cocina-models', '~> 0.108.0'
29
29
  spec.add_dependency 'deprecation', '>= 0'
30
30
  spec.add_dependency 'faraday', '~> 2.0'
31
31
  spec.add_dependency 'faraday-retry'
@@ -8,6 +8,7 @@ module Dor
8
8
  # API calls that are about a repository object
9
9
  class Object < VersionedService # rubocop:disable Metrics/ClassLength
10
10
  extend Deprecation
11
+
11
12
  attr_reader :object_identifier
12
13
 
13
14
  # @param object_identifier [String] the pid for the object
@@ -78,6 +78,22 @@ module Dor
78
78
  JSON.parse(resp.body).transform_values { |status| ObjectVersion::VersionStatus.new(status.symbolize_keys!) }
79
79
  end
80
80
 
81
+ # Verify the object can be indexed into Solr
82
+ # @param [String] druid the object's druid
83
+ # @param [Cocina::Models::DROWithoutMetadata] cocina the cocina object to verify
84
+ # @raise [UnprocessableContent] when the response is not successful.
85
+ # @return [string] JSON representation of the descriptive solr document
86
+ def indexable(druid:, cocina:)
87
+ resp = connection.post do |req|
88
+ req.url "#{objects_path}/#{druid}/indexable"
89
+ req.headers['Content-Type'] = 'application/json'
90
+ req.body = cocina.to_json
91
+ end
92
+ return true if resp.success?
93
+
94
+ raise_exception_based_on_response!(resp)
95
+ end
96
+
81
97
  private
82
98
 
83
99
  def objects_path
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '15.23.0'
6
+ VERSION = '15.25.0'
7
7
  end
8
8
  end
9
9
  end
@@ -10,7 +10,8 @@ module Dor
10
10
  401 => UnauthorizedResponse,
11
11
  404 => NotFoundResponse,
12
12
  409 => ConflictResponse,
13
- 412 => PreconditionFailedResponse
13
+ 412 => PreconditionFailedResponse,
14
+ 422 => UnprocessableContentError
14
15
  }.freeze
15
16
 
16
17
  JSON_API_MIME_TYPE = 'application/vnd.api+json'
@@ -79,6 +79,10 @@ module Dor
79
79
  # Error that is raised when the remote server returns a 400 Bad Request; apps should not retry the request
80
80
  class BadRequestError < UnexpectedResponse; end
81
81
 
82
+ # Error that is raised when the remote server returns a 422 Unprocessable Content
83
+ # This occurs when the request is well-formed but the content is not indexable
84
+ class UnprocessableContentError < UnexpectedResponse; end
85
+
82
86
  module Types
83
87
  include Dry.Types()
84
88
  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.23.0
4
+ version: 15.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.107.0
33
+ version: 0.108.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.107.0
40
+ version: 0.108.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: deprecation
43
43
  requirement: !ruby/object:Gem::Requirement