preservation-client 4.0.0 → 5.0.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: 7eee0269825cc3a5d9d0829cb77182adbc808bca2fe5d7dab6a7fc835d387e1d
4
- data.tar.gz: b6bf9a6c5b2999beaece87a2501a31e8c436258f9dc44bd8c5eadf6e8fc9e520
3
+ metadata.gz: 39ea8bf13aa4ea7f31c0e1b6db7fd7949c64cf4c38d3118d27786d6fa63aa39e
4
+ data.tar.gz: 26ca36a68ebf7f529da2f6e35e9728613efbf9160ef389e867bd29f071d93390
5
5
  SHA512:
6
- metadata.gz: '0855b28859c90a6a5f65d648434dc2895f2da1eb69cbebac0b0ebad90a451c71cd1122a3664ea073b64aa96fe945c26a358e8d756569d47b1180f56d79198ded'
7
- data.tar.gz: b50c7d13f330e7cd5fcd3b651adc7570ced9db6c40c658d8f14f6f3dafc3d5e250f0ddf4088e3888a7e39e28c91406996770b21a718779b08e9e8688a2233ffb
6
+ metadata.gz: cbc73fe77e36da28cc23d000da1d3fda2bd66d3b287e8ff0c71b176b970d8a83fae43d2ba1d01d03bfca5d040c17192f7b9253bfcf234d8bd2a8e1cfbe100cf5
7
+ data.tar.gz: 6a64a04556ba1d4fb3e609a2a86a1603baaaf7f1a6d669eaab9d810e3e5ff66218437db454d9be0dcdfd9e304f1271a321baf80d3f697164fb166e0ed7457237
data/.circleci/config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  version: 2.1
2
2
  orbs:
3
- ruby-rails: sul-dlss/ruby-rails@2.0.0
3
+ ruby-rails: sul-dlss/ruby-rails@3.1.2
4
4
  workflows:
5
5
  build:
6
6
  jobs:
@@ -1,12 +1,9 @@
1
- ## Why was this change made?
1
+ ## Why was this change made? 🤔
2
2
 
3
3
 
4
4
 
5
- ## How was this change tested?
6
-
7
-
8
-
9
- ## Which documentation and/or configurations were updated?
5
+ ## How was this change tested? 🤨
10
6
 
7
+ ⚡ ⚠ If this change has cross service impact, run ***[integration test create_preassembly_image_spec.rb](https://github.com/sul-dlss/infrastructure-integration-test)*** on stage as it tests preservation, and/or test in stage environment, in addition to specs.⚡
11
8
 
12
9
 
data/.gitignore CHANGED
@@ -8,6 +8,4 @@
8
8
  # rspec failure tracking
9
9
  .rspec_status
10
10
 
11
- Gemfile.lock
12
-
13
11
  .pry_history
data/.rubocop.yml CHANGED
@@ -6,6 +6,21 @@ require:
6
6
 
7
7
  AllCops:
8
8
  TargetRubyVersion: 3.0
9
+ SuggestExtensions: false
10
+ DisplayCopNames: true
11
+ Include:
12
+ - './Rakefile' # rake only
13
+ - '**/*.rb'
14
+ - '**/*.rake' # rake only
15
+ Exclude:
16
+ # autogenerated files (that we don't change) should go here
17
+ - 'bin/**/*'
18
+ - 'config/environments/*.rb' # rails only
19
+ - 'config/routes.rb' # rails only
20
+ - 'db/**/*' # rails only
21
+ - 'spec/spec_helper.rb'
22
+ - 'spec/rails_helper.rb' # rails only
23
+ - 'vendor/**/*' # gems only (?)
9
24
 
10
25
  Layout/EmptyLinesAroundClassBody:
11
26
  Enabled: false
@@ -24,6 +39,20 @@ Layout/LineLength:
24
39
  Metrics/MethodLength:
25
40
  Max: 25
26
41
 
42
+ # do try to keep examples short (can you split out the setup from the test?)
43
+ RSpec/ExampleLength:
44
+ Enabled: false
45
+
46
+ # most tests should test a single thing
47
+ RSpec/MultipleExpectations:
48
+ Max: 5 # default 1
49
+
50
+ RSpec/MultipleMemoizedHelpers:
51
+ Enabled: false
52
+
53
+ RSpec/NestedGroups:
54
+ Max: 5 # default: 3
55
+
27
56
  Style/Documentation:
28
57
  Exclude:
29
58
  - 'spec/**/*'
@@ -31,8 +60,6 @@ Style/Documentation:
31
60
  Style/WordArray:
32
61
  Enabled: false
33
62
 
34
- Gemspec/DateAssignment: # new in 1.10
35
- Enabled: true
36
63
  Gemspec/RequireMFA: # new in 1.23
37
64
  Enabled: true
38
65
  Layout/LineEndStringConcatenationIndentation: # new in 1.18
@@ -144,3 +171,54 @@ RSpec/FactoryBot/SyntaxMethods: # new in 2.7
144
171
  Enabled: true
145
172
  RSpec/Rails/AvoidSetupHook: # new in 2.4
146
173
  Enabled: true
174
+ Gemspec/DeprecatedAttributeAssignment: # new in 1.30
175
+ Enabled: true
176
+ Layout/LineContinuationLeadingSpace: # new in 1.31
177
+ Enabled: true
178
+ Layout/LineContinuationSpacing: # new in 1.31
179
+ Enabled: true
180
+ Lint/ConstantOverwrittenInRescue: # new in 1.31
181
+ Enabled: true
182
+ Lint/NonAtomicFileOperation: # new in 1.31
183
+ Enabled: true
184
+ Lint/RefinementImportMethods: # new in 1.27
185
+ Enabled: true
186
+ Security/CompoundHash: # new in 1.28
187
+ Enabled: true
188
+ Style/EnvHome: # new in 1.29
189
+ Enabled: true
190
+ Style/FetchEnvVar: # new in 1.28
191
+ Enabled: true
192
+ Style/MapCompactWithConditionalBlock: # new in 1.30
193
+ Enabled: true
194
+ Style/NestedFileDirname: # new in 1.26
195
+ Enabled: true
196
+ Style/ObjectThen: # new in 1.28
197
+ Enabled: true
198
+ Style/RedundantInitialize: # new in 1.27
199
+ Enabled: true
200
+ RSpec/BeEq: # new in 2.9.0
201
+ Enabled: true
202
+ RSpec/BeNil: # new in 2.9.0
203
+ Enabled: true
204
+ RSpec/ChangeByZero: # new in 2.11.0
205
+ Enabled: true
206
+ RSpec/VerifiedDoubleReference: # new in 2.10.0
207
+ Enabled: true
208
+
209
+ Lint/RequireRangeParentheses: # new in 1.32
210
+ Enabled: true
211
+ Style/EmptyHeredoc: # new in 1.32
212
+ Enabled: true
213
+ Style/MagicCommentFormat: # new in 1.35
214
+ Enabled: true
215
+ RSpec/ClassCheck: # new in 2.13
216
+ Enabled: true
217
+ RSpec/NoExpectationExample: # new in 2.13
218
+ Enabled: true
219
+ RSpec/Capybara/SpecificFinders: # new in 2.13
220
+ Enabled: true
221
+ RSpec/Capybara/SpecificMatcher: # new in 2.12
222
+ Enabled: true
223
+ RSpec/Rails/HaveHttpStatus: # new in 2.12
224
+ Enabled: true
data/.rubocop_todo.yml CHANGED
@@ -1,92 +1,19 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --auto-gen-only-exclude`
3
- # on 2022-01-14 04:40:44 UTC using RuboCop version 1.24.1.
3
+ # on 2022-10-04 18:22:01 UTC using RuboCop version 1.36.0.
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: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/RequiredRubyVersion:
13
- Exclude:
14
- - 'preservation-client.gemspec'
15
-
16
9
  # Offense count: 2
17
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes, Max.
10
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes, Max.
18
11
  Metrics/AbcSize:
19
12
  Exclude:
20
13
  - 'lib/preservation/client/versioned_api_service.rb'
21
14
 
22
15
  # Offense count: 1
23
- # Configuration parameters: IgnoredMethods, Max.
16
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
24
17
  Metrics/CyclomaticComplexity:
25
18
  Exclude:
26
19
  - 'lib/preservation/client/versioned_api_service.rb'
27
-
28
- # Offense count: 1
29
- # Configuration parameters: Prefixes.
30
- # Prefixes: when, with, without
31
- RSpec/ContextWording:
32
- Exclude:
33
- - 'spec/preservation/client_spec.rb'
34
-
35
- # Offense count: 2
36
- # Configuration parameters: Max, CountAsOne.
37
- RSpec/ExampleLength:
38
- Exclude:
39
- - 'spec/preservation/client/objects_spec.rb'
40
- - 'spec/preservation/client_spec.rb'
41
-
42
- # Offense count: 1
43
- RSpec/IdenticalEqualityAssertion:
44
- Exclude:
45
- - 'spec/preservation/client_spec.rb'
46
-
47
- # Offense count: 4
48
- # Configuration parameters: Max.
49
- RSpec/MultipleExpectations:
50
- Exclude:
51
- - 'spec/preservation/client/objects_spec.rb'
52
- - 'spec/preservation/client/response_error_formatter_spec.rb'
53
- - 'spec/preservation/client_spec.rb'
54
-
55
- # Offense count: 66
56
- # Configuration parameters: AllowSubject, Max.
57
- RSpec/MultipleMemoizedHelpers:
58
- Exclude:
59
- - 'spec/preservation/client/catalog_spec.rb'
60
- - 'spec/preservation/client/objects_spec.rb'
61
- - 'spec/preservation/client/response_error_formatter_spec.rb'
62
- - 'spec/preservation/client/versioned_api_service_spec.rb'
63
-
64
- # Offense count: 10
65
- # Configuration parameters: IgnoreSharedExamples.
66
- RSpec/NamedSubject:
67
- Exclude:
68
- - 'spec/preservation/client/versioned_api_service_spec.rb'
69
-
70
- # Offense count: 10
71
- # Configuration parameters: Max.
72
- RSpec/NestedGroups:
73
- Exclude:
74
- - 'spec/preservation/client/catalog_spec.rb'
75
- - 'spec/preservation/client/versioned_api_service_spec.rb'
76
-
77
- # Offense count: 4
78
- # Cop supports --auto-correct.
79
- RSpec/ScatteredLet:
80
- Exclude:
81
- - 'spec/preservation/client/objects_spec.rb'
82
-
83
- # Offense count: 24
84
- RSpec/SubjectStub:
85
- Exclude:
86
- - 'spec/preservation/client/objects_spec.rb'
87
-
88
- # Offense count: 4
89
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
90
- RSpec/VerifiedDoubles:
91
- Exclude:
92
- - 'spec/preservation/client/response_error_formatter_spec.rb'
data/Gemfile.lock ADDED
@@ -0,0 +1,130 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ preservation-client (5.0.0)
5
+ activesupport (>= 4.2, < 8)
6
+ faraday (~> 2.0)
7
+ moab-versioning (~> 5.0)
8
+ zeitwerk (~> 2.1)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ activesupport (7.0.4)
14
+ concurrent-ruby (~> 1.0, >= 1.0.2)
15
+ i18n (>= 1.6, < 2)
16
+ minitest (>= 5.1)
17
+ tzinfo (~> 2.0)
18
+ addressable (2.8.1)
19
+ public_suffix (>= 2.0.2, < 6.0)
20
+ ast (2.4.2)
21
+ byebug (11.1.3)
22
+ coderay (1.1.3)
23
+ concurrent-ruby (1.1.10)
24
+ crack (0.4.5)
25
+ rexml
26
+ diff-lcs (1.5.0)
27
+ docile (1.4.0)
28
+ druid-tools (3.0.0)
29
+ faraday (2.5.2)
30
+ faraday-net_http (>= 2.0, < 3.1)
31
+ ruby2_keywords (>= 0.0.4)
32
+ faraday-net_http (3.0.0)
33
+ hashdiff (1.0.1)
34
+ i18n (1.12.0)
35
+ concurrent-ruby (~> 1.0)
36
+ json (2.6.2)
37
+ method_source (1.0.0)
38
+ mini_portile2 (2.8.0)
39
+ minitest (5.16.3)
40
+ moab-versioning (5.2.0)
41
+ druid-tools (>= 1.0.0)
42
+ json
43
+ nokogiri
44
+ nokogiri-happymapper
45
+ nokogiri (1.13.8)
46
+ mini_portile2 (~> 2.8.0)
47
+ racc (~> 1.4)
48
+ nokogiri (1.13.8-x86_64-darwin)
49
+ racc (~> 1.4)
50
+ nokogiri-happymapper (0.9.0)
51
+ nokogiri (~> 1.5)
52
+ parallel (1.22.1)
53
+ parser (3.1.2.1)
54
+ ast (~> 2.4.1)
55
+ pry (0.14.1)
56
+ coderay (~> 1.1)
57
+ method_source (~> 1.0)
58
+ pry-byebug (3.10.1)
59
+ byebug (~> 11.0)
60
+ pry (>= 0.13, < 0.15)
61
+ public_suffix (5.0.0)
62
+ racc (1.6.0)
63
+ rainbow (3.1.1)
64
+ rake (13.0.6)
65
+ regexp_parser (2.6.0)
66
+ rexml (3.2.5)
67
+ rspec (3.11.0)
68
+ rspec-core (~> 3.11.0)
69
+ rspec-expectations (~> 3.11.0)
70
+ rspec-mocks (~> 3.11.0)
71
+ rspec-core (3.11.0)
72
+ rspec-support (~> 3.11.0)
73
+ rspec-expectations (3.11.1)
74
+ diff-lcs (>= 1.2.0, < 2.0)
75
+ rspec-support (~> 3.11.0)
76
+ rspec-mocks (3.11.1)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.11.0)
79
+ rspec-support (3.11.1)
80
+ rubocop (1.36.0)
81
+ json (~> 2.3)
82
+ parallel (~> 1.10)
83
+ parser (>= 3.1.2.1)
84
+ rainbow (>= 2.2.2, < 4.0)
85
+ regexp_parser (>= 1.8, < 3.0)
86
+ rexml (>= 3.2.5, < 4.0)
87
+ rubocop-ast (>= 1.20.1, < 2.0)
88
+ ruby-progressbar (~> 1.7)
89
+ unicode-display_width (>= 1.4.0, < 3.0)
90
+ rubocop-ast (1.21.0)
91
+ parser (>= 3.1.1.0)
92
+ rubocop-rake (0.6.0)
93
+ rubocop (~> 1.0)
94
+ rubocop-rspec (2.13.2)
95
+ rubocop (~> 1.33)
96
+ ruby-progressbar (1.11.0)
97
+ ruby2_keywords (0.0.5)
98
+ simplecov (0.21.2)
99
+ docile (~> 1.1)
100
+ simplecov-html (~> 0.11)
101
+ simplecov_json_formatter (~> 0.1)
102
+ simplecov-html (0.12.3)
103
+ simplecov_json_formatter (0.1.4)
104
+ tzinfo (2.0.5)
105
+ concurrent-ruby (~> 1.0)
106
+ unicode-display_width (2.3.0)
107
+ webmock (3.18.1)
108
+ addressable (>= 2.8.0)
109
+ crack (>= 0.3.2)
110
+ hashdiff (>= 0.4.0, < 2.0.0)
111
+ zeitwerk (2.6.1)
112
+
113
+ PLATFORMS
114
+ x86_64-darwin-19
115
+ x86_64-linux
116
+
117
+ DEPENDENCIES
118
+ bundler (~> 2.0)
119
+ preservation-client!
120
+ pry-byebug
121
+ rake (>= 12.3.3)
122
+ rspec (~> 3.0)
123
+ rubocop (~> 1.24)
124
+ rubocop-rake
125
+ rubocop-rspec (~> 2.1)
126
+ simplecov
127
+ webmock
128
+
129
+ BUNDLED WITH
130
+ 2.3.17
data/README.md CHANGED
@@ -88,10 +88,6 @@ Note that the preservation service is behind a firewall.
88
88
  - `client.objects.metadata(druid: 'oo000oo0000', filepath: 'identityMetadata.xml', version: '8')` - returns contents of identityMetadata.xml in version 8 of Moab object
89
89
  - `client.objects.signature_catalog('oo000oo0000')` - returns latest Moab::SignatureCatalog from Moab
90
90
 
91
- ### Retrieve the primary moab storage location
92
-
93
- - `client.objects.primary_moab_location(druid: 'ooo000oo0000')` - returns the path to the storage location for the primary moab
94
-
95
91
  ### Validate the Moab
96
92
 
97
93
  - `client.objects.validate_moab(druid: 'ooo000oo0000')` - validates that the Moab object, used by preservationWF to ensure we have a valid Moab before replicating to various preservation endpoints
@@ -99,6 +95,7 @@ Note that the preservation service is behind a firewall.
99
95
  ### Get difference information between passed contentMetadata.xml and files in the Moab
100
96
 
101
97
  - `client.objects.content_inventory_diff(druid: 'oo000oo0000', content_metadata: '<contentMetadata>...</contentMetadata>')` - returns Moab::FileInventoryDifference containing differences between passed content metadata and latest version for subset 'all'
98
+
102
99
  - you may specify the subset (all|shelve|preserve|publish) and/or the version:
103
100
  - `client.objects.content_inventory_diff(druid: 'oo000oo0000', subset: 'publish', version: '1', content_metadata: '<contentMetadata>...</contentMetadata>')`
104
101
 
@@ -107,6 +104,7 @@ Note that the preservation service is behind a firewall.
107
104
  ### Alert the catalog that an object has been changed and needs to be updated
108
105
 
109
106
  - `client.update(druid: 'oo000oo0000', version: 3, size: 2342, storage_location: 'some/storage/location')` - returns true if it worked
107
+
110
108
  ## Development
111
109
 
112
110
  After checking out the repo, run `bundle` 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.
@@ -80,15 +80,6 @@ module Preservation
80
80
  get("objects/#{druid}/validate_moab", {}, on_data: nil)
81
81
  end
82
82
 
83
- # retrieve the storage location for the primary moab of the given druid
84
- # @param [String] druid - with or without prefix: 'druid:ab123cd4567' or 'ab123cd4567'
85
- # @return [String] the storage location of the primary moab for the given druid
86
- # @raise [Preservation::Client::NotFoundError] when druid is not found
87
- # @raise [Preservation::Client::LockedError] when druid is in locked state (not available for versioning)
88
- def primary_moab_location(druid:)
89
- get("objects/#{druid}/primary_moab_location", {}, on_data: nil)
90
- end
91
-
92
83
  # convenience method for retrieving latest Moab::SignatureCatalog from a Moab object,
93
84
  # @param [String] druid - with or without prefix: 'druid:ab123cd4567' OR 'ab123cd4567'
94
85
  # @return [Moab::SignatureCatalog] the manifest of all files previously ingested
@@ -4,9 +4,9 @@ module Preservation
4
4
  class Client
5
5
  # Format HTTP response-related errors
6
6
  class ResponseErrorFormatter
7
- DEFAULT_BODY = 'Response from preservation-catalog did not contain a body. '\
8
- 'Check honeybadger for preservation-catalog for backtraces, '\
9
- 'and look into adding a `rescue_from` in preservation-catalog '\
7
+ DEFAULT_BODY = 'Response from preservation-catalog did not contain a body. ' \
8
+ 'Check honeybadger for preservation-catalog for backtraces, ' \
9
+ 'and look into adding a `rescue_from` in preservation-catalog ' \
10
10
  'to provide more details to the client in the future.'
11
11
 
12
12
  def self.format(response:, object_id: nil, client_method_name: nil)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Preservation
4
4
  class Client
5
- VERSION = '4.0.0'
5
+ VERSION = '5.0.0'
6
6
  end
7
7
  end
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = 'exe'
28
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
29
  spec.require_paths = ['lib']
30
- spec.required_ruby_version = '>= 2.7' # 3.0 except for dor-services-app
30
+ spec.required_ruby_version = '>= 3.0'
31
31
 
32
32
  spec.add_dependency 'activesupport', '>= 4.2', '< 8'
33
33
  spec.add_dependency 'faraday', '~> 2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: preservation-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naomi Dushay
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-01 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -213,6 +213,7 @@ files:
213
213
  - ".rubocop.yml"
214
214
  - ".rubocop_todo.yml"
215
215
  - Gemfile
216
+ - Gemfile.lock
216
217
  - LICENSE
217
218
  - README.md
218
219
  - Rakefile
@@ -241,14 +242,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
241
242
  requirements:
242
243
  - - ">="
243
244
  - !ruby/object:Gem::Version
244
- version: '2.7'
245
+ version: '3.0'
245
246
  required_rubygems_version: !ruby/object:Gem::Requirement
246
247
  requirements:
247
248
  - - ">="
248
249
  - !ruby/object:Gem::Version
249
250
  version: '0'
250
251
  requirements: []
251
- rubygems_version: 3.2.32
252
+ rubygems_version: 3.3.22
252
253
  signing_key:
253
254
  specification_version: 4
254
255
  summary: A thin client for getting info from SDR preservation.