preservation-client 3.5.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +8 -33
- data/.github/pull_request_template.md +3 -6
- data/.gitignore +0 -2
- data/.rubocop.yml +198 -2
- data/.rubocop_todo.yml +8 -4
- data/Gemfile.lock +130 -0
- data/README.md +2 -4
- data/lib/preservation/client/error_faraday_middleware.rb +1 -1
- data/lib/preservation/client/objects.rb +0 -9
- data/lib/preservation/client/response_error_formatter.rb +3 -3
- data/lib/preservation/client/version.rb +1 -1
- data/lib/preservation/client/versioned_api_service.rb +3 -3
- data/lib/preservation/client.rb +1 -0
- data/preservation-client.gemspec +8 -4
- metadata +46 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39ea8bf13aa4ea7f31c0e1b6db7fd7949c64cf4c38d3118d27786d6fa63aa39e
|
4
|
+
data.tar.gz: 26ca36a68ebf7f529da2f6e35e9728613efbf9160ef389e867bd29f071d93390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbc73fe77e36da28cc23d000da1d3fda2bd66d3b287e8ff0c71b176b970d8a83fae43d2ba1d01d03bfca5d040c17192f7b9253bfcf234d8bd2a8e1cfbe100cf5
|
7
|
+
data.tar.gz: 6a64a04556ba1d4fb3e609a2a86a1603baaaf7f1a6d669eaab9d810e3e5ff66218437db454d9be0dcdfd9e304f1271a321baf80d3f697164fb166e0ed7457237
|
data/.circleci/config.yml
CHANGED
@@ -1,35 +1,10 @@
|
|
1
1
|
version: 2.1
|
2
|
-
|
3
|
-
|
2
|
+
orbs:
|
3
|
+
ruby-rails: sul-dlss/ruby-rails@3.1.2
|
4
|
+
workflows:
|
4
5
|
build:
|
5
|
-
|
6
|
-
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- checkout
|
12
|
-
- run:
|
13
|
-
name: Install Bundler
|
14
|
-
command: gem install bundler
|
15
|
-
- run:
|
16
|
-
name: Which bundler?
|
17
|
-
command: bundle -v
|
18
|
-
- run:
|
19
|
-
name: Bundle Install
|
20
|
-
command: bundle check || bundle install
|
21
|
-
- run:
|
22
|
-
name: Lint using rubocop
|
23
|
-
command: bundle exec rubocop
|
24
|
-
- run:
|
25
|
-
name: Setup Code Climate test-reporter
|
26
|
-
command: |
|
27
|
-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
28
|
-
chmod +x ./cc-test-reporter
|
29
|
-
./cc-test-reporter before-build
|
30
|
-
- run:
|
31
|
-
name: rspec
|
32
|
-
command: bundle exec rspec
|
33
|
-
- run:
|
34
|
-
name: upload test coverage report to Code Climate
|
35
|
-
command: ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $?
|
6
|
+
jobs:
|
7
|
+
- ruby-rails/lint:
|
8
|
+
name: lint
|
9
|
+
- ruby-rails/test-gem:
|
10
|
+
name: test
|
@@ -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
data/.rubocop.yml
CHANGED
@@ -1,7 +1,26 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
2
|
|
3
|
+
require:
|
4
|
+
- rubocop-rspec
|
5
|
+
- rubocop-rake
|
6
|
+
|
3
7
|
AllCops:
|
4
|
-
TargetRubyVersion:
|
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 (?)
|
5
24
|
|
6
25
|
Layout/EmptyLinesAroundClassBody:
|
7
26
|
Enabled: false
|
@@ -11,7 +30,7 @@ Metrics/BlockLength:
|
|
11
30
|
- 'preservation-client.gemspec'
|
12
31
|
- 'spec/**/*'
|
13
32
|
|
14
|
-
|
33
|
+
Layout/LineLength:
|
15
34
|
Max: 120
|
16
35
|
Exclude:
|
17
36
|
- 'lib/preservation/client/response_error_formatter.rb'
|
@@ -20,9 +39,186 @@ Metrics/LineLength:
|
|
20
39
|
Metrics/MethodLength:
|
21
40
|
Max: 25
|
22
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
|
+
|
23
56
|
Style/Documentation:
|
24
57
|
Exclude:
|
25
58
|
- 'spec/**/*'
|
26
59
|
|
27
60
|
Style/WordArray:
|
28
61
|
Enabled: false
|
62
|
+
|
63
|
+
Gemspec/RequireMFA: # new in 1.23
|
64
|
+
Enabled: true
|
65
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
66
|
+
Enabled: true
|
67
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
68
|
+
Enabled: true
|
69
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
70
|
+
Enabled: true
|
71
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
72
|
+
Enabled: true
|
73
|
+
Lint/AmbiguousRange: # new in 1.19
|
74
|
+
Enabled: true
|
75
|
+
Lint/DeprecatedConstants: # new in 1.8
|
76
|
+
Enabled: true
|
77
|
+
Lint/DuplicateBranch: # new in 1.3
|
78
|
+
Enabled: true
|
79
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
80
|
+
Enabled: true
|
81
|
+
Lint/EmptyBlock: # new in 1.1
|
82
|
+
Enabled: true
|
83
|
+
Lint/EmptyClass: # new in 1.3
|
84
|
+
Enabled: true
|
85
|
+
Lint/EmptyInPattern: # new in 1.16
|
86
|
+
Enabled: true
|
87
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
88
|
+
Enabled: true
|
89
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
90
|
+
Enabled: true
|
91
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
92
|
+
Enabled: true
|
93
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
94
|
+
Enabled: true
|
95
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
96
|
+
Enabled: true
|
97
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
98
|
+
Enabled: true
|
99
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
100
|
+
Enabled: true
|
101
|
+
Lint/SymbolConversion: # new in 1.9
|
102
|
+
Enabled: true
|
103
|
+
Lint/ToEnumArguments: # new in 1.1
|
104
|
+
Enabled: true
|
105
|
+
Lint/TripleQuotes: # new in 1.9
|
106
|
+
Enabled: true
|
107
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
108
|
+
Enabled: true
|
109
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
110
|
+
Enabled: true
|
111
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
112
|
+
Enabled: true
|
113
|
+
Naming/BlockForwarding: # new in 1.24
|
114
|
+
Enabled: true
|
115
|
+
Security/IoMethods: # new in 1.22
|
116
|
+
Enabled: true
|
117
|
+
Style/ArgumentsForwarding: # new in 1.1
|
118
|
+
Enabled: true
|
119
|
+
Style/CollectionCompact: # new in 1.2
|
120
|
+
Enabled: true
|
121
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
122
|
+
Enabled: true
|
123
|
+
Style/EndlessMethod: # new in 1.8
|
124
|
+
Enabled: true
|
125
|
+
Style/FileRead: # new in 1.24
|
126
|
+
Enabled: true
|
127
|
+
Style/FileWrite: # new in 1.24
|
128
|
+
Enabled: true
|
129
|
+
Style/HashConversion: # new in 1.10
|
130
|
+
Enabled: true
|
131
|
+
Style/HashExcept: # new in 1.7
|
132
|
+
Enabled: true
|
133
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
134
|
+
Enabled: true
|
135
|
+
Style/InPatternThen: # new in 1.16
|
136
|
+
Enabled: true
|
137
|
+
Style/MapToHash: # new in 1.24
|
138
|
+
Enabled: true
|
139
|
+
Style/MultilineInPatternThen: # new in 1.16
|
140
|
+
Enabled: true
|
141
|
+
Style/NegatedIfElseCondition: # new in 1.2
|
142
|
+
Enabled: true
|
143
|
+
Style/NilLambda: # new in 1.3
|
144
|
+
Enabled: true
|
145
|
+
Style/NumberedParameters: # new in 1.22
|
146
|
+
Enabled: true
|
147
|
+
Style/NumberedParametersLimit: # new in 1.22
|
148
|
+
Enabled: true
|
149
|
+
Style/OpenStructUse: # new in 1.23
|
150
|
+
Enabled: true
|
151
|
+
Style/QuotedSymbols: # new in 1.16
|
152
|
+
Enabled: true
|
153
|
+
Style/RedundantArgument: # new in 1.4
|
154
|
+
Enabled: true
|
155
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
156
|
+
Enabled: true
|
157
|
+
Style/SelectByRegexp: # new in 1.22
|
158
|
+
Enabled: true
|
159
|
+
Style/StringChars: # new in 1.12
|
160
|
+
Enabled: true
|
161
|
+
Style/SwapValues: # new in 1.1
|
162
|
+
Enabled: true
|
163
|
+
|
164
|
+
RSpec/ExcessiveDocstringSpacing: # new in 2.5
|
165
|
+
Enabled: true
|
166
|
+
RSpec/IdenticalEqualityAssertion: # new in 2.4
|
167
|
+
Enabled: true
|
168
|
+
RSpec/SubjectDeclaration: # new in 2.5
|
169
|
+
Enabled: true
|
170
|
+
RSpec/FactoryBot/SyntaxMethods: # new in 2.7
|
171
|
+
Enabled: true
|
172
|
+
RSpec/Rails/AvoidSetupHook: # new in 2.4
|
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,15 +1,19 @@
|
|
1
1
|
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
2
|
+
# `rubocop --auto-gen-config --auto-gen-only-exclude`
|
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
9
|
# Offense count: 2
|
10
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes, Max.
|
10
11
|
Metrics/AbcSize:
|
11
|
-
|
12
|
+
Exclude:
|
13
|
+
- 'lib/preservation/client/versioned_api_service.rb'
|
12
14
|
|
13
15
|
# Offense count: 1
|
16
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
|
14
17
|
Metrics/CyclomaticComplexity:
|
15
|
-
|
18
|
+
Exclude:
|
19
|
+
- 'lib/preservation/client/versioned_api_service.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.
|
@@ -4,7 +4,7 @@ module Preservation
|
|
4
4
|
class Client
|
5
5
|
# This wraps any faraday connection errors with preservation-client errors
|
6
6
|
# see https://www.rubydoc.info/gems/faraday/Faraday/ClientError for info on errors
|
7
|
-
class ErrorFaradayMiddleware < Faraday::
|
7
|
+
class ErrorFaradayMiddleware < Faraday::Middleware
|
8
8
|
def call(env)
|
9
9
|
@app.call(env)
|
10
10
|
rescue Faraday::ConnectionFailed, Faraday::SSLError, Faraday::TimeoutError => e
|
@@ -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)
|
@@ -31,7 +31,7 @@ module Preservation
|
|
31
31
|
raise NotFoundError, errmsg
|
32
32
|
rescue Faraday::Error => e
|
33
33
|
errmsg = "Preservation::Client.#{caller_locations.first.label} for #{object_id} " \
|
34
|
-
|
34
|
+
"got #{e.response[:status]} from Preservation at #{req_url}: #{e.response[:body]}"
|
35
35
|
raise UnexpectedResponseError, errmsg
|
36
36
|
end
|
37
37
|
|
@@ -90,11 +90,11 @@ module Preservation
|
|
90
90
|
raise UnexpectedResponseError, errmsg
|
91
91
|
rescue Faraday::ResourceNotFound => e
|
92
92
|
errmsg = "Preservation::Client.#{caller_locations.first.label} " \
|
93
|
-
|
93
|
+
"got #{e.response[:status]} from Preservation at #{req_url}: #{e.response[:body]}"
|
94
94
|
raise NotFoundError, errmsg
|
95
95
|
rescue Faraday::Error => e
|
96
96
|
errmsg = "Preservation::Client.#{caller_locations.first.label} " \
|
97
|
-
|
97
|
+
"got #{e.response[:status]} from Preservation at #{req_url}: #{e.response[:body]}"
|
98
98
|
exception_class = e.response[:status] == 423 ? LockedError : UnexpectedResponseError
|
99
99
|
raise exception_class, errmsg
|
100
100
|
end
|
data/lib/preservation/client.rb
CHANGED
data/preservation-client.gemspec
CHANGED
@@ -27,17 +27,21 @@ 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 = '>= 3.0'
|
30
31
|
|
31
32
|
spec.add_dependency 'activesupport', '>= 4.2', '< 8'
|
32
|
-
spec.add_dependency 'faraday', '
|
33
|
-
spec.add_dependency 'moab-versioning', '~>
|
33
|
+
spec.add_dependency 'faraday', '~> 2.0'
|
34
|
+
spec.add_dependency 'moab-versioning', '~> 5.0'
|
34
35
|
spec.add_dependency 'zeitwerk', '~> 2.1'
|
35
36
|
|
36
37
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
37
38
|
spec.add_development_dependency 'pry-byebug'
|
38
39
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
39
40
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
40
|
-
spec.add_development_dependency 'rubocop', '~>
|
41
|
-
spec.add_development_dependency '
|
41
|
+
spec.add_development_dependency 'rubocop', '~> 1.24'
|
42
|
+
spec.add_development_dependency 'rubocop-rake'
|
43
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
|
44
|
+
spec.add_development_dependency 'simplecov'
|
42
45
|
spec.add_development_dependency 'webmock'
|
46
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
43
47
|
end
|
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
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naomi Dushay
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -34,20 +34,14 @@ dependencies:
|
|
34
34
|
name: faraday
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: '0.15'
|
40
|
-
- - "<"
|
37
|
+
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
39
|
version: '2.0'
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
45
42
|
version_requirements: !ruby/object:Gem::Requirement
|
46
43
|
requirements:
|
47
|
-
- - "
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: '0.15'
|
50
|
-
- - "<"
|
44
|
+
- - "~>"
|
51
45
|
- !ruby/object:Gem::Version
|
52
46
|
version: '2.0'
|
53
47
|
- !ruby/object:Gem::Dependency
|
@@ -56,14 +50,14 @@ dependencies:
|
|
56
50
|
requirements:
|
57
51
|
- - "~>"
|
58
52
|
- !ruby/object:Gem::Version
|
59
|
-
version: '
|
53
|
+
version: '5.0'
|
60
54
|
type: :runtime
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
57
|
requirements:
|
64
58
|
- - "~>"
|
65
59
|
- !ruby/object:Gem::Version
|
66
|
-
version: '
|
60
|
+
version: '5.0'
|
67
61
|
- !ruby/object:Gem::Dependency
|
68
62
|
name: zeitwerk
|
69
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,28 +134,56 @@ dependencies:
|
|
140
134
|
requirements:
|
141
135
|
- - "~>"
|
142
136
|
- !ruby/object:Gem::Version
|
143
|
-
version:
|
137
|
+
version: '1.24'
|
144
138
|
type: :development
|
145
139
|
prerelease: false
|
146
140
|
version_requirements: !ruby/object:Gem::Requirement
|
147
141
|
requirements:
|
148
142
|
- - "~>"
|
149
143
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
144
|
+
version: '1.24'
|
151
145
|
- !ruby/object:Gem::Dependency
|
152
|
-
name:
|
146
|
+
name: rubocop-rake
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :development
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: rubocop-rspec
|
153
161
|
requirement: !ruby/object:Gem::Requirement
|
154
162
|
requirements:
|
155
163
|
- - "~>"
|
156
164
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
165
|
+
version: '2.1'
|
158
166
|
type: :development
|
159
167
|
prerelease: false
|
160
168
|
version_requirements: !ruby/object:Gem::Requirement
|
161
169
|
requirements:
|
162
170
|
- - "~>"
|
163
171
|
- !ruby/object:Gem::Version
|
164
|
-
version:
|
172
|
+
version: '2.1'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: simplecov
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :development
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
165
187
|
- !ruby/object:Gem::Dependency
|
166
188
|
name: webmock
|
167
189
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,6 +213,7 @@ files:
|
|
191
213
|
- ".rubocop.yml"
|
192
214
|
- ".rubocop_todo.yml"
|
193
215
|
- Gemfile
|
216
|
+
- Gemfile.lock
|
194
217
|
- LICENSE
|
195
218
|
- README.md
|
196
219
|
- Rakefile
|
@@ -210,7 +233,8 @@ metadata:
|
|
210
233
|
allowed_push_host: https://rubygems.org/
|
211
234
|
homepage_uri: https://github.com/sul-dlss/preservation-client
|
212
235
|
source_code_uri: https://github.com/sul-dlss/preservation-client.
|
213
|
-
|
236
|
+
rubygems_mfa_required: 'true'
|
237
|
+
post_install_message:
|
214
238
|
rdoc_options: []
|
215
239
|
require_paths:
|
216
240
|
- lib
|
@@ -218,15 +242,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
242
|
requirements:
|
219
243
|
- - ">="
|
220
244
|
- !ruby/object:Gem::Version
|
221
|
-
version: '0'
|
245
|
+
version: '3.0'
|
222
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
247
|
requirements:
|
224
248
|
- - ">="
|
225
249
|
- !ruby/object:Gem::Version
|
226
250
|
version: '0'
|
227
251
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
229
|
-
signing_key:
|
252
|
+
rubygems_version: 3.3.22
|
253
|
+
signing_key:
|
230
254
|
specification_version: 4
|
231
255
|
summary: A thin client for getting info from SDR preservation.
|
232
256
|
test_files: []
|