dor-services-client 12.13.1 → 12.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b8de200f6193d8e744f8cab4930cad5159b4281fbc3fd4429633b9c948c5d5d
4
- data.tar.gz: 73358f87f3c44e26c139af90707c1f85717eafcb5dd67701f1895d7c4e6682ba
3
+ metadata.gz: 4fe87932d48e8a6840dff66151357c8fc8e9c86c0e0265a55bd023f941d070ac
4
+ data.tar.gz: e9a45ea67d9e74b2078330905fdb880af3520284a45745a71580a312a49d576b
5
5
  SHA512:
6
- metadata.gz: 66d744fe7122da02402ae97240fb4cfdba9a1622537c8266f558040ff01eefe78db76394ee7556787f5ca8e6e20a6719d2fed37b68edcd745fe0970c0514b3fa
7
- data.tar.gz: 46de253f11dcb355a66d25e0d1bcda06ecc66d7f10870da3e4e8b123ddb57cd03c74af76ea46f381088d009aec1e864771816a249a7fcde14acfe3186ac23a89
6
+ metadata.gz: bcda85a815b2f7934b925c9e6e90f5afc41f0d14e9c8186112cc2543d67c6505f616d361d05e91ac4639e2e2ce5437e79c09a5677ebaa94376caa08d750ad1a3
7
+ data.tar.gz: b771139f84a28dfe35094f9ad4105ec2048243d8369eb60935083d6618a31c1f05d76df93dd7f0748f56bba2323a202e092f7dfe7b4ae60e76b0cadbd51b03ae
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@3.2.0
3
+ ruby-rails: sul-dlss/ruby-rails@4.0.0
4
4
  workflows:
5
5
  build:
6
6
  jobs:
data/.rubocop.yml CHANGED
@@ -133,7 +133,7 @@ RSpec/IdenticalEqualityAssertion: # new in 2.4
133
133
  Enabled: true
134
134
  RSpec/SubjectDeclaration: # new in 2.5
135
135
  Enabled: true
136
- RSpec/FactoryBot/SyntaxMethods: # new in 2.7
136
+ FactoryBot/SyntaxMethods: # new in 2.7
137
137
  Enabled: true
138
138
  RSpec/Rails/AvoidSetupHook: # new in 2.4
139
139
  Enabled: true
@@ -177,7 +177,7 @@ Style/MapCompactWithConditionalBlock: # new in 1.30
177
177
  Enabled: true
178
178
  RSpec/ChangeByZero: # new in 2.11.0
179
179
  Enabled: true
180
- RSpec/Capybara/SpecificMatcher: # new in 2.12
180
+ Capybara/SpecificMatcher: # new in 2.12
181
181
  Enabled: false
182
182
  RSpec/Rails/HaveHttpStatus: # new in 2.12
183
183
  Enabled: false
@@ -186,5 +186,94 @@ RSpec/ClassCheck: # new in 2.13
186
186
  Enabled: true
187
187
  RSpec/NoExpectationExample: # new in 2.13
188
188
  Enabled: true
189
- RSpec/Capybara/SpecificFinders: # new in 2.13
189
+ Capybara/SpecificFinders: # new in 2.13
190
+ Enabled: true
191
+
192
+ Gemspec/DevelopmentDependencies: # new in 1.44
193
+ Enabled: false
194
+ Lint/DuplicateMagicComment: # new in 1.37
195
+ Enabled: true
196
+ Lint/DuplicateMatchPattern: # new in 1.50
197
+ Enabled: true
198
+ Lint/UselessRescue: # new in 1.43
199
+ Enabled: true
200
+ Metrics/CollectionLiteralLength: # new in 1.47
201
+ Enabled: true
202
+ Style/ArrayIntersect: # new in 1.40
203
+ Enabled: true
204
+ Style/ComparableClamp: # new in 1.44
205
+ Enabled: true
206
+ Style/ConcatArrayLiterals: # new in 1.41
207
+ Enabled: true
208
+ Style/DataInheritance: # new in 1.49
209
+ Enabled: true
210
+ Style/DirEmpty: # new in 1.48
211
+ Enabled: true
212
+ Style/ExactRegexpMatch: # new in 1.51
213
+ Enabled: true
214
+ Style/FileEmpty: # new in 1.48
215
+ Enabled: true
216
+ Style/MapToSet: # new in 1.42
217
+ Enabled: true
218
+ Style/MinMaxComparison: # new in 1.42
219
+ Enabled: true
220
+ Style/OperatorMethodCall: # new in 1.37
221
+ Enabled: true
222
+ Style/RedundantArrayConstructor: # new in 1.52
223
+ Enabled: true
224
+ Style/RedundantConstantBase: # new in 1.40
225
+ Enabled: true
226
+ Style/RedundantDoubleSplatHashBraces: # new in 1.41
227
+ Enabled: true
228
+ Style/RedundantEach: # new in 1.38
229
+ Enabled: true
230
+ Style/RedundantFilterChain: # new in 1.52
231
+ Enabled: true
232
+ Style/RedundantHeredocDelimiterQuotes: # new in 1.45
233
+ Enabled: true
234
+ Style/RedundantLineContinuation: # new in 1.49
235
+ Enabled: true
236
+ Style/RedundantRegexpConstructor: # new in 1.52
237
+ Enabled: true
238
+ Style/RedundantStringEscape: # new in 1.37
239
+ Enabled: true
240
+ Capybara/MatchStyle: # new in 2.17
241
+ Enabled: true
242
+ Capybara/NegationMatcher: # new in 2.14
243
+ Enabled: true
244
+ Capybara/SpecificActions: # new in 2.14
245
+ Enabled: true
246
+ FactoryBot/AssociationStyle: # new in 2.23
247
+ Enabled: true
248
+ FactoryBot/ConsistentParenthesesStyle: # new in 2.14
249
+ Enabled: true
250
+ FactoryBot/FactoryAssociationWithStrategy: # new in 2.23
251
+ Enabled: true
252
+ FactoryBot/FactoryNameStyle: # new in 2.16
253
+ Enabled: true
254
+ FactoryBot/RedundantFactoryOption: # new in 2.23
255
+ Enabled: true
256
+ RSpec/BeEmpty: # new in 2.20
257
+ Enabled: true
258
+ RSpec/ContainExactly: # new in 2.19
259
+ Enabled: true
260
+ RSpec/DuplicatedMetadata: # new in 2.16
261
+ Enabled: true
262
+ RSpec/IndexedLet: # new in 2.20
263
+ Enabled: true
264
+ RSpec/MatchArray: # new in 2.19
265
+ Enabled: true
266
+ RSpec/PendingWithoutReason: # new in 2.16
267
+ Enabled: true
268
+ RSpec/RedundantAround: # new in 2.19
269
+ Enabled: true
270
+ RSpec/SkipBlockInsideExample: # new in 2.19
271
+ Enabled: true
272
+ RSpec/SortMetadata: # new in 2.14
273
+ Enabled: true
274
+ RSpec/Rails/InferredSpecType: # new in 2.14
275
+ Enabled: true
276
+ RSpec/Rails/MinitestAssertions: # new in 2.17
277
+ Enabled: true
278
+ RSpec/Rails/TravelAround: # new in 2.19
190
279
  Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,28 +1,27 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
- # on 2022-01-14 01:12:44 UTC using RuboCop version 1.24.1.
3
+ # on 2023-06-20 05:36:17 UTC using RuboCop version 1.52.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 2
10
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
9
+ # Offense count: 1
10
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
11
11
  Metrics/AbcSize:
12
12
  Exclude:
13
13
  - 'lib/dor/services/client/marcxml.rb'
14
14
 
15
15
  # Offense count: 1
16
- # Configuration parameters: CountComments, Max, CountAsOne, ExcludedMethods, IgnoredMethods.
16
+ # Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns.
17
17
  Metrics/MethodLength:
18
18
  Exclude:
19
19
  - 'lib/dor/services/client/transfer.rb'
20
20
 
21
- # Offense count: 4
21
+ # Offense count: 3
22
22
  RSpec/AnyInstance:
23
23
  Exclude:
24
24
  - 'spec/dor/services/client/async_result_spec.rb'
25
- - 'spec/dor/services/client/metadata_spec.rb'
26
25
  - 'spec/dor/services/client/object_version_spec.rb'
27
26
 
28
27
  # Offense count: 6
@@ -31,18 +30,17 @@ RSpec/IdenticalEqualityAssertion:
31
30
  - 'spec/dor/services/client_spec.rb'
32
31
 
33
32
  # Offense count: 1
34
- # Cop supports --auto-correct.
33
+ # This cop supports safe autocorrection (--autocorrect).
35
34
  RSpec/MultipleSubjects:
36
35
  Exclude:
37
36
  - 'spec/dor/services/client/object_spec.rb'
38
37
 
39
- # Offense count: 13
40
- # Configuration parameters: Max.
38
+ # Offense count: 9
39
+ # Configuration parameters: Max, AllowedGroups.
41
40
  RSpec/NestedGroups:
42
41
  Exclude:
43
42
  - 'spec/dor/services/client/accession_spec.rb'
44
43
  - 'spec/dor/services/client/background_job_results_spec.rb'
45
- - 'spec/dor/services/client/metadata_spec.rb'
46
44
  - 'spec/dor/services/client/objects_spec.rb'
47
45
  - 'spec/dor/services/client_spec.rb'
48
46
 
@@ -65,9 +63,9 @@ Style/Documentation:
65
63
  - 'test/**/*'
66
64
  - 'lib/dor/services/client.rb'
67
65
 
68
- # Offense count: 77
69
- # Cop supports --auto-correct.
70
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
66
+ # Offense count: 47
67
+ # This cop supports safe autocorrection (--autocorrect).
68
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
71
69
  # URISchemes: http, https
72
70
  Layout/LineLength:
73
71
  Max: 164
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dor-services-client (12.13.1)
4
+ dor-services-client (12.15.0)
5
5
  activesupport (>= 4.2, < 8)
6
- cocina-models (~> 0.89.0)
6
+ cocina-models (~> 0.90.0)
7
7
  deprecation
8
8
  faraday (~> 2.0)
9
9
  faraday-retry
@@ -12,17 +12,17 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (7.0.4.2)
15
+ activesupport (7.0.6)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 1.6, < 2)
18
18
  minitest (>= 5.1)
19
19
  tzinfo (~> 2.0)
20
- addressable (2.8.1)
20
+ addressable (2.8.4)
21
21
  public_suffix (>= 2.0.2, < 6.0)
22
22
  ast (2.4.2)
23
23
  attr_extras (7.1.0)
24
24
  byebug (11.1.3)
25
- cocina-models (0.89.1)
25
+ cocina-models (0.90.0)
26
26
  activesupport
27
27
  deprecation
28
28
  dry-struct (~> 1.0)
@@ -37,7 +37,7 @@ GEM
37
37
  super_diff
38
38
  thor
39
39
  zeitwerk (~> 2.1)
40
- commonmarker (0.23.8)
40
+ commonmarker (0.23.9)
41
41
  concurrent-ruby (1.2.2)
42
42
  crack (0.4.5)
43
43
  rexml
@@ -68,72 +68,78 @@ GEM
68
68
  activesupport (>= 3.0, < 8.0)
69
69
  equivalent-xml (0.6.0)
70
70
  nokogiri (>= 1.4.3)
71
- faraday (2.7.4)
71
+ faraday (2.7.10)
72
72
  faraday-net_http (>= 2.0, < 3.1)
73
73
  ruby2_keywords (>= 0.0.4)
74
74
  faraday-net_http (3.0.2)
75
- faraday-retry (2.1.0)
75
+ faraday-retry (2.2.0)
76
76
  faraday (~> 2.0)
77
77
  hashdiff (1.0.1)
78
- i18n (1.12.0)
78
+ i18n (1.14.1)
79
79
  concurrent-ruby (~> 1.0)
80
80
  ice_nine (0.11.2)
81
81
  json (2.6.3)
82
- jsonpath (1.1.2)
82
+ jsonpath (1.1.3)
83
83
  multi_json
84
- minitest (5.18.0)
84
+ language_server-protocol (3.17.0.3)
85
+ minitest (5.18.1)
85
86
  multi_json (1.15.0)
86
- nokogiri (1.14.2-x86_64-darwin)
87
+ nokogiri (1.15.3-x86_64-darwin)
87
88
  racc (~> 1.4)
88
- nokogiri (1.14.2-x86_64-linux)
89
+ nokogiri (1.15.3-x86_64-linux)
89
90
  racc (~> 1.4)
90
91
  openapi3_parser (0.9.2)
91
92
  commonmarker (~> 0.17)
92
93
  openapi_parser (0.15.0)
93
94
  optimist (3.0.1)
94
- parallel (1.22.1)
95
- parser (3.2.1.0)
95
+ parallel (1.23.0)
96
+ parser (3.2.2.3)
96
97
  ast (~> 2.4.1)
98
+ racc
97
99
  patience_diff (1.2.0)
98
100
  optimist (~> 3.0)
99
101
  public_suffix (5.0.1)
100
- racc (1.6.2)
102
+ racc (1.7.1)
101
103
  rainbow (3.1.1)
102
104
  rake (13.0.6)
103
- regexp_parser (2.7.0)
105
+ regexp_parser (2.8.1)
104
106
  rexml (3.2.5)
105
107
  rspec (3.12.0)
106
108
  rspec-core (~> 3.12.0)
107
109
  rspec-expectations (~> 3.12.0)
108
110
  rspec-mocks (~> 3.12.0)
109
- rspec-core (3.12.1)
111
+ rspec-core (3.12.2)
110
112
  rspec-support (~> 3.12.0)
111
- rspec-expectations (3.12.2)
113
+ rspec-expectations (3.12.3)
112
114
  diff-lcs (>= 1.2.0, < 2.0)
113
115
  rspec-support (~> 3.12.0)
114
- rspec-mocks (3.12.3)
116
+ rspec-mocks (3.12.5)
115
117
  diff-lcs (>= 1.2.0, < 2.0)
116
118
  rspec-support (~> 3.12.0)
117
- rspec-support (3.12.0)
119
+ rspec-support (3.12.1)
118
120
  rss (0.2.9)
119
121
  rexml
120
- rubocop (1.48.0)
122
+ rubocop (1.54.1)
121
123
  json (~> 2.3)
124
+ language_server-protocol (>= 3.17.0)
122
125
  parallel (~> 1.10)
123
- parser (>= 3.2.0.0)
126
+ parser (>= 3.2.2.3)
124
127
  rainbow (>= 2.2.2, < 4.0)
125
128
  regexp_parser (>= 1.8, < 3.0)
126
129
  rexml (>= 3.2.5, < 4.0)
127
- rubocop-ast (>= 1.26.0, < 2.0)
130
+ rubocop-ast (>= 1.28.0, < 2.0)
128
131
  ruby-progressbar (~> 1.7)
129
132
  unicode-display_width (>= 2.4.0, < 3.0)
130
- rubocop-ast (1.27.0)
133
+ rubocop-ast (1.29.0)
131
134
  parser (>= 3.2.1.0)
132
- rubocop-capybara (2.17.1)
135
+ rubocop-capybara (2.18.0)
133
136
  rubocop (~> 1.41)
134
- rubocop-rspec (2.18.1)
137
+ rubocop-factory_bot (2.23.1)
138
+ rubocop (~> 1.33)
139
+ rubocop-rspec (2.22.0)
135
140
  rubocop (~> 1.33)
136
141
  rubocop-capybara (~> 2.17)
142
+ rubocop-factory_bot (~> 2.22)
137
143
  ruby-progressbar (1.13.0)
138
144
  ruby2_keywords (0.0.5)
139
145
  simplecov (0.22.0)
@@ -142,11 +148,11 @@ GEM
142
148
  simplecov_json_formatter (~> 0.1)
143
149
  simplecov-html (0.12.3)
144
150
  simplecov_json_formatter (0.1.4)
145
- super_diff (0.9.0)
151
+ super_diff (0.10.0)
146
152
  attr_extras (>= 6.2.4)
147
153
  diff-lcs
148
154
  patience_diff
149
- thor (1.2.1)
155
+ thor (1.2.2)
150
156
  tzinfo (2.0.6)
151
157
  concurrent-ruby (~> 1.0)
152
158
  unicode-display_width (2.4.2)
@@ -154,12 +160,13 @@ GEM
154
160
  addressable (>= 2.8.0)
155
161
  crack (>= 0.3.2)
156
162
  hashdiff (>= 0.4.0, < 2.0.0)
157
- zeitwerk (2.6.7)
163
+ zeitwerk (2.6.8)
158
164
 
159
165
  PLATFORMS
160
166
  x86_64-darwin-19
161
167
  x86_64-darwin-20
162
168
  x86_64-darwin-21
169
+ x86_64-darwin-22
163
170
  x86_64-linux
164
171
 
165
172
  DEPENDENCIES
@@ -174,4 +181,4 @@ DEPENDENCIES
174
181
  webmock
175
182
 
176
183
  BUNDLED WITH
177
- 2.4.6
184
+ 2.4.13
data/README.md CHANGED
@@ -114,6 +114,12 @@ object_client.preserve(lane_id: 'low')
114
114
  # Update the MARC record (used in the releaseWF)
115
115
  object_client.update_marc_record
116
116
 
117
+ # Update the DOI metadata (used by robot)
118
+ object_client.update_doi_metadata
119
+
120
+ # Update the Orcid work (used by robot)
121
+ object_client.update_orcid_work
122
+
117
123
  # Copy metadata from Symphony into descMetadata
118
124
  object_client.refresh_descriptive_metadata_from_ils
119
125
 
@@ -132,15 +138,6 @@ object_client.version.open(description: 'Changed title', significance: 'minor')
132
138
  # see dor-services-app openapi.yml for optional params
133
139
  object_client.version.close
134
140
 
135
- # Get the Dublin Core XML representation
136
- object_client.metadata.dublin_core
137
-
138
- # Get the public descriptive XML representation
139
- object_client.metadata.descriptive
140
-
141
- # Get the public XML representation
142
- object_client.metadata.public_xml
143
-
144
141
  # Return the Cocina metadata
145
142
  object_client.find
146
143
 
@@ -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.89.0'
28
+ spec.add_dependency 'cocina-models', '~> 0.90.0'
29
29
  spec.add_dependency 'deprecation', '>= 0'
30
30
  spec.add_dependency 'faraday', '~> 2.0'
31
31
  spec.add_dependency 'faraday-retry'
@@ -18,10 +18,6 @@ module Dor
18
18
  @object_identifier = object_identifier
19
19
  end
20
20
 
21
- def metadata
22
- @metadata ||= Metadata.new(**parent_params)
23
- end
24
-
25
21
  def events
26
22
  @events ||= Events.new(**parent_params)
27
23
  end
@@ -110,6 +106,18 @@ module Dor
110
106
  raise_exception_based_on_response!(resp)
111
107
  end
112
108
 
109
+ # Update the ORCID Work
110
+ # @raise [NotFoundResponse] when the response is a 404 (object not found)
111
+ # @return [Boolean] true on success
112
+ def update_orcid_work
113
+ resp = connection.post do |req|
114
+ req.url "#{object_path}/update_orcid_work"
115
+ end
116
+ return true if resp.success?
117
+
118
+ raise_exception_based_on_response!(resp)
119
+ end
120
+
113
121
  # Notify the external Goobi system for a new object that was registered in DOR
114
122
  # @raise [NotFoundResponse] when the response is a 404 (object not found)
115
123
  # @raise [UnexpectedResponse] when the response is not successful.
@@ -3,7 +3,7 @@
3
3
  module Dor
4
4
  module Services
5
5
  class Client
6
- VERSION = '12.13.1'
6
+ VERSION = '12.15.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.13.1
4
+ version: 12.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  - Michael Giarlo
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-03-07 00:00:00.000000000 Z
12
+ date: 2023-07-17 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.89.0
40
+ version: 0.90.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.89.0
47
+ version: 0.90.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: deprecation
50
50
  requirement: !ruby/object:Gem::Requirement
@@ -213,7 +213,7 @@ dependencies:
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
- description:
216
+ description:
217
217
  email:
218
218
  - jcoyne@justincoyne.com
219
219
  - leftwing@alumni.rutgers.edu
@@ -247,7 +247,6 @@ files:
247
247
  - lib/dor/services/client/events.rb
248
248
  - lib/dor/services/client/marcxml.rb
249
249
  - lib/dor/services/client/members.rb
250
- - lib/dor/services/client/metadata.rb
251
250
  - lib/dor/services/client/mutate.rb
252
251
  - lib/dor/services/client/object.rb
253
252
  - lib/dor/services/client/object_version.rb
@@ -262,7 +261,7 @@ homepage: https://github.com/sul-dlss/dor-services-client
262
261
  licenses: []
263
262
  metadata:
264
263
  rubygems_mfa_required: 'true'
265
- post_install_message:
264
+ post_install_message:
266
265
  rdoc_options: []
267
266
  require_paths:
268
267
  - lib
@@ -280,8 +279,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
279
  - !ruby/object:Gem::Version
281
280
  version: '0'
282
281
  requirements: []
283
- rubygems_version: 3.2.32
284
- signing_key:
282
+ rubygems_version: 3.3.7
283
+ signing_key:
285
284
  specification_version: 4
286
285
  summary: A client for dor-services-app
287
286
  test_files: []
@@ -1,74 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'active_support/json' # required for serializing time as iso8601
4
-
5
- module Dor
6
- module Services
7
- class Client
8
- # API calls that are about retrieving metadata
9
- class Metadata < VersionedService
10
- # @param object_identifier [String] the pid for the object
11
- def initialize(connection:, version:, object_identifier:)
12
- super(connection: connection, version: version)
13
- @object_identifier = object_identifier
14
- end
15
-
16
- # @return [String, NilClass] The Dublin Core XML representation of the object or nil if response is 404
17
- # @raise [UnexpectedResponse] on an unsuccessful response from the server
18
- def dublin_core
19
- resp = connection.get do |req|
20
- req.url "#{base_path}/dublin_core"
21
- end
22
- return resp.body if resp.success?
23
- return if resp.status == 404
24
-
25
- raise_exception_based_on_response!(resp, object_identifier)
26
- end
27
-
28
- # @return [String, NilClass] The public descriptive metadata XML representation of the object or nil if response is 404
29
- # @raise [UnexpectedResponse] on an unsuccessful response from the server
30
- def descriptive
31
- resp = connection.get do |req|
32
- req.url "#{base_path}/descriptive"
33
- end
34
- return resp.body if resp.success?
35
- return if resp.status == 404
36
-
37
- raise_exception_based_on_response!(resp, object_identifier)
38
- end
39
-
40
- # @return [String, NilClass] The public XML representation of the object or nil if response is 404
41
- # @raise [UnexpectedResponse] on an unsuccessful response from the server
42
- def public_xml
43
- resp = connection.get do |req|
44
- req.url "#{base_path}/public_xml"
45
- end
46
- return resp.body if resp.success?
47
- return if resp.status == 404
48
-
49
- raise_exception_based_on_response!(resp, object_identifier)
50
- end
51
-
52
- # @return [String, NilClass] the dor object's source MODS XML or nil if response is 404
53
- # @raise [UnexpectedResponse] on an unsuccessful response from the server
54
- def mods
55
- resp = connection.get do |req|
56
- req.url "#{base_path}/mods"
57
- end
58
- return resp.body if resp.success?
59
- return if resp.status == 404
60
-
61
- raise_exception_based_on_response!(resp, object_identifier)
62
- end
63
-
64
- private
65
-
66
- attr_reader :object_identifier
67
-
68
- def base_path
69
- "#{api_version}/objects/#{object_identifier}/metadata"
70
- end
71
- end
72
- end
73
- end
74
- end