preservation-client 6.1.0 → 7.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 +1 -1
- data/.rubocop.yml +92 -3
- data/.rubocop_todo.yml +2 -8
- data/Gemfile.lock +40 -30
- data/README.md +3 -4
- data/lib/preservation/client/objects.rb +4 -5
- data/lib/preservation/client/version.rb +1 -1
- data/lib/preservation/client/versioned_api_service.rb +11 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ea7074b6f7968d89b5fad106ff66fe8d15b5fa1d9995396bcafb05c348bb764
|
4
|
+
data.tar.gz: 0b724aabce34538335e7e1ec55fe62ad799d7d3c97c49e6e980f597ca3c05161
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0435faf772dfec04d6c53c9a9c7bf5700598b1bc0b9bbb77497bb65e2e81c819474ff421cfeef5bcbcb24bafe1436546513424e1e0f81e49432bd57fd56efd35
|
7
|
+
data.tar.gz: 403420c16c0f3224fe64b5a70c5ae1e80f4e80470a6a93e392abb375a8de60acced13630ebf51a49ea118874a73b101217cef8076a50ff61e7385340846f457f
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -167,7 +167,7 @@ RSpec/IdenticalEqualityAssertion: # new in 2.4
|
|
167
167
|
Enabled: true
|
168
168
|
RSpec/SubjectDeclaration: # new in 2.5
|
169
169
|
Enabled: true
|
170
|
-
|
170
|
+
FactoryBot/SyntaxMethods: # new in 2.7
|
171
171
|
Enabled: true
|
172
172
|
RSpec/Rails/AvoidSetupHook: # new in 2.4
|
173
173
|
Enabled: true
|
@@ -216,9 +216,98 @@ RSpec/ClassCheck: # new in 2.13
|
|
216
216
|
Enabled: true
|
217
217
|
RSpec/NoExpectationExample: # new in 2.13
|
218
218
|
Enabled: true
|
219
|
-
|
219
|
+
Capybara/SpecificFinders: # new in 2.13
|
220
220
|
Enabled: true
|
221
|
-
|
221
|
+
Capybara/SpecificMatcher: # new in 2.12
|
222
222
|
Enabled: true
|
223
223
|
RSpec/Rails/HaveHttpStatus: # new in 2.12
|
224
224
|
Enabled: true
|
225
|
+
|
226
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
227
|
+
Enabled: true
|
228
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
229
|
+
Enabled: true
|
230
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
231
|
+
Enabled: true
|
232
|
+
Lint/UselessRescue: # new in 1.43
|
233
|
+
Enabled: true
|
234
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
235
|
+
Enabled: true
|
236
|
+
Style/ArrayIntersect: # new in 1.40
|
237
|
+
Enabled: true
|
238
|
+
Style/ComparableClamp: # new in 1.44
|
239
|
+
Enabled: true
|
240
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
241
|
+
Enabled: true
|
242
|
+
Style/DataInheritance: # new in 1.49
|
243
|
+
Enabled: true
|
244
|
+
Style/DirEmpty: # new in 1.48
|
245
|
+
Enabled: true
|
246
|
+
Style/ExactRegexpMatch: # new in 1.51
|
247
|
+
Enabled: true
|
248
|
+
Style/FileEmpty: # new in 1.48
|
249
|
+
Enabled: true
|
250
|
+
Style/MapToSet: # new in 1.42
|
251
|
+
Enabled: true
|
252
|
+
Style/MinMaxComparison: # new in 1.42
|
253
|
+
Enabled: true
|
254
|
+
Style/OperatorMethodCall: # new in 1.37
|
255
|
+
Enabled: true
|
256
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
257
|
+
Enabled: true
|
258
|
+
Style/RedundantConstantBase: # new in 1.40
|
259
|
+
Enabled: true
|
260
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
261
|
+
Enabled: true
|
262
|
+
Style/RedundantEach: # new in 1.38
|
263
|
+
Enabled: true
|
264
|
+
Style/RedundantFilterChain: # new in 1.52
|
265
|
+
Enabled: true
|
266
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
267
|
+
Enabled: true
|
268
|
+
Style/RedundantLineContinuation: # new in 1.49
|
269
|
+
Enabled: true
|
270
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
271
|
+
Enabled: true
|
272
|
+
Style/RedundantStringEscape: # new in 1.37
|
273
|
+
Enabled: true
|
274
|
+
Capybara/MatchStyle: # new in 2.17
|
275
|
+
Enabled: true
|
276
|
+
Capybara/NegationMatcher: # new in 2.14
|
277
|
+
Enabled: true
|
278
|
+
Capybara/SpecificActions: # new in 2.14
|
279
|
+
Enabled: true
|
280
|
+
FactoryBot/AssociationStyle: # new in 2.23
|
281
|
+
Enabled: true
|
282
|
+
FactoryBot/ConsistentParenthesesStyle: # new in 2.14
|
283
|
+
Enabled: true
|
284
|
+
FactoryBot/FactoryAssociationWithStrategy: # new in 2.23
|
285
|
+
Enabled: true
|
286
|
+
FactoryBot/FactoryNameStyle: # new in 2.16
|
287
|
+
Enabled: true
|
288
|
+
FactoryBot/RedundantFactoryOption: # new in 2.23
|
289
|
+
Enabled: true
|
290
|
+
RSpec/BeEmpty: # new in 2.20
|
291
|
+
Enabled: true
|
292
|
+
RSpec/ContainExactly: # new in 2.19
|
293
|
+
Enabled: true
|
294
|
+
RSpec/DuplicatedMetadata: # new in 2.16
|
295
|
+
Enabled: true
|
296
|
+
RSpec/IndexedLet: # new in 2.20
|
297
|
+
Enabled: true
|
298
|
+
RSpec/MatchArray: # new in 2.19
|
299
|
+
Enabled: true
|
300
|
+
RSpec/PendingWithoutReason: # new in 2.16
|
301
|
+
Enabled: true
|
302
|
+
RSpec/RedundantAround: # new in 2.19
|
303
|
+
Enabled: true
|
304
|
+
RSpec/SkipBlockInsideExample: # new in 2.19
|
305
|
+
Enabled: true
|
306
|
+
RSpec/SortMetadata: # new in 2.14
|
307
|
+
Enabled: true
|
308
|
+
RSpec/Rails/InferredSpecType: # new in 2.14
|
309
|
+
Enabled: true
|
310
|
+
RSpec/Rails/MinitestAssertions: # new in 2.17
|
311
|
+
Enabled: true
|
312
|
+
RSpec/Rails/TravelAround: # new in 2.19
|
313
|
+
Enabled: true
|
data/.rubocop_todo.yml
CHANGED
@@ -1,19 +1,13 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --auto-gen-only-exclude`
|
3
|
-
# on
|
3
|
+
# on 2023-06-20 05:20:15 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
9
|
# Offense count: 2
|
10
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns,
|
10
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
11
11
|
Metrics/AbcSize:
|
12
12
|
Exclude:
|
13
13
|
- 'lib/preservation/client/versioned_api_service.rb'
|
14
|
-
|
15
|
-
# Offense count: 1
|
16
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, Max.
|
17
|
-
Metrics/CyclomaticComplexity:
|
18
|
-
Exclude:
|
19
|
-
- 'lib/preservation/client/versioned_api_service.rb'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
preservation-client (
|
4
|
+
preservation-client (7.0.0)
|
5
5
|
activesupport (>= 4.2, < 8)
|
6
6
|
faraday (~> 2.0)
|
7
7
|
moab-versioning (>= 5.0.0, < 7)
|
@@ -10,91 +10,99 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (7.0.
|
13
|
+
activesupport (7.0.7.2)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
17
17
|
tzinfo (~> 2.0)
|
18
|
-
addressable (2.8.
|
18
|
+
addressable (2.8.5)
|
19
19
|
public_suffix (>= 2.0.2, < 6.0)
|
20
20
|
ast (2.4.2)
|
21
|
+
base64 (0.1.1)
|
21
22
|
byebug (11.1.3)
|
22
23
|
coderay (1.1.3)
|
23
|
-
concurrent-ruby (1.2.
|
24
|
+
concurrent-ruby (1.2.2)
|
24
25
|
crack (0.4.5)
|
25
26
|
rexml
|
26
27
|
diff-lcs (1.5.0)
|
27
28
|
docile (1.4.0)
|
28
29
|
druid-tools (3.0.0)
|
29
|
-
faraday (2.7.
|
30
|
+
faraday (2.7.10)
|
30
31
|
faraday-net_http (>= 2.0, < 3.1)
|
31
32
|
ruby2_keywords (>= 0.0.4)
|
32
33
|
faraday-net_http (3.0.2)
|
33
34
|
hashdiff (1.0.1)
|
34
|
-
i18n (1.
|
35
|
+
i18n (1.14.1)
|
35
36
|
concurrent-ruby (~> 1.0)
|
36
37
|
json (2.6.3)
|
38
|
+
language_server-protocol (3.17.0.3)
|
37
39
|
method_source (1.0.0)
|
38
|
-
minitest (5.
|
40
|
+
minitest (5.19.0)
|
39
41
|
moab-versioning (6.1.0)
|
40
42
|
druid-tools (>= 1.0.0)
|
41
43
|
json
|
42
44
|
nokogiri
|
43
45
|
nokogiri-happymapper
|
44
|
-
nokogiri (1.
|
46
|
+
nokogiri (1.15.4-x86_64-darwin)
|
45
47
|
racc (~> 1.4)
|
46
|
-
nokogiri (1.
|
48
|
+
nokogiri (1.15.4-x86_64-linux)
|
47
49
|
racc (~> 1.4)
|
48
50
|
nokogiri-happymapper (0.9.0)
|
49
51
|
nokogiri (~> 1.5)
|
50
|
-
parallel (1.
|
51
|
-
parser (3.2.
|
52
|
+
parallel (1.23.0)
|
53
|
+
parser (3.2.2.3)
|
52
54
|
ast (~> 2.4.1)
|
55
|
+
racc
|
53
56
|
pry (0.14.2)
|
54
57
|
coderay (~> 1.1)
|
55
58
|
method_source (~> 1.0)
|
56
59
|
pry-byebug (3.10.1)
|
57
60
|
byebug (~> 11.0)
|
58
61
|
pry (>= 0.13, < 0.15)
|
59
|
-
public_suffix (5.0.
|
60
|
-
racc (1.
|
62
|
+
public_suffix (5.0.3)
|
63
|
+
racc (1.7.1)
|
61
64
|
rainbow (3.1.1)
|
62
65
|
rake (13.0.6)
|
63
|
-
regexp_parser (2.
|
64
|
-
rexml (3.2.
|
66
|
+
regexp_parser (2.8.1)
|
67
|
+
rexml (3.2.6)
|
65
68
|
rspec (3.12.0)
|
66
69
|
rspec-core (~> 3.12.0)
|
67
70
|
rspec-expectations (~> 3.12.0)
|
68
71
|
rspec-mocks (~> 3.12.0)
|
69
|
-
rspec-core (3.12.
|
72
|
+
rspec-core (3.12.2)
|
70
73
|
rspec-support (~> 3.12.0)
|
71
|
-
rspec-expectations (3.12.
|
74
|
+
rspec-expectations (3.12.3)
|
72
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
73
76
|
rspec-support (~> 3.12.0)
|
74
|
-
rspec-mocks (3.12.
|
77
|
+
rspec-mocks (3.12.6)
|
75
78
|
diff-lcs (>= 1.2.0, < 2.0)
|
76
79
|
rspec-support (~> 3.12.0)
|
77
|
-
rspec-support (3.12.
|
78
|
-
rubocop (1.
|
80
|
+
rspec-support (3.12.1)
|
81
|
+
rubocop (1.56.1)
|
82
|
+
base64 (~> 0.1.1)
|
79
83
|
json (~> 2.3)
|
84
|
+
language_server-protocol (>= 3.17.0)
|
80
85
|
parallel (~> 1.10)
|
81
|
-
parser (>= 3.2.
|
86
|
+
parser (>= 3.2.2.3)
|
82
87
|
rainbow (>= 2.2.2, < 4.0)
|
83
88
|
regexp_parser (>= 1.8, < 3.0)
|
84
89
|
rexml (>= 3.2.5, < 4.0)
|
85
|
-
rubocop-ast (>= 1.
|
90
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
86
91
|
ruby-progressbar (~> 1.7)
|
87
92
|
unicode-display_width (>= 2.4.0, < 3.0)
|
88
|
-
rubocop-ast (1.
|
89
|
-
parser (>= 3.
|
90
|
-
rubocop-capybara (2.
|
93
|
+
rubocop-ast (1.29.0)
|
94
|
+
parser (>= 3.2.1.0)
|
95
|
+
rubocop-capybara (2.18.0)
|
91
96
|
rubocop (~> 1.41)
|
97
|
+
rubocop-factory_bot (2.23.1)
|
98
|
+
rubocop (~> 1.33)
|
92
99
|
rubocop-rake (0.6.0)
|
93
100
|
rubocop (~> 1.0)
|
94
|
-
rubocop-rspec (2.
|
101
|
+
rubocop-rspec (2.23.2)
|
95
102
|
rubocop (~> 1.33)
|
96
103
|
rubocop-capybara (~> 2.17)
|
97
|
-
|
104
|
+
rubocop-factory_bot (~> 2.22)
|
105
|
+
ruby-progressbar (1.13.0)
|
98
106
|
ruby2_keywords (0.0.5)
|
99
107
|
simplecov (0.22.0)
|
100
108
|
docile (~> 1.1)
|
@@ -105,15 +113,17 @@ GEM
|
|
105
113
|
tzinfo (2.0.6)
|
106
114
|
concurrent-ruby (~> 1.0)
|
107
115
|
unicode-display_width (2.4.2)
|
108
|
-
webmock (3.
|
116
|
+
webmock (3.19.0)
|
109
117
|
addressable (>= 2.8.0)
|
110
118
|
crack (>= 0.3.2)
|
111
119
|
hashdiff (>= 0.4.0, < 2.0.0)
|
112
|
-
zeitwerk (2.6.
|
120
|
+
zeitwerk (2.6.11)
|
113
121
|
|
114
122
|
PLATFORMS
|
115
123
|
x86_64-darwin-19
|
116
124
|
x86_64-darwin-20
|
125
|
+
x86_64-darwin-21
|
126
|
+
x86_64-darwin-22
|
117
127
|
x86_64-linux
|
118
128
|
|
119
129
|
DEPENDENCIES
|
@@ -129,4 +139,4 @@ DEPENDENCIES
|
|
129
139
|
webmock
|
130
140
|
|
131
141
|
BUNDLED WITH
|
132
|
-
2.4.
|
142
|
+
2.4.13
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ Preservation::Client is a singleton object, and thus can be used as a class or a
|
|
31
31
|
require 'preservation/client'
|
32
32
|
|
33
33
|
def do_the_thing
|
34
|
-
current_version_as_integer = client.current_version('druid:oo000oo0000')
|
34
|
+
current_version_as_integer = client.objects.current_version('druid:oo000oo0000')
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
@@ -51,7 +51,7 @@ def initialize
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def do_the_thing
|
54
|
-
current_version_as_integer = Preservation::Client.current_version('druid:oo000oo0000')
|
54
|
+
current_version_as_integer = Preservation::Client.objects.current_version('druid:oo000oo0000')
|
55
55
|
end
|
56
56
|
```
|
57
57
|
|
@@ -72,8 +72,7 @@ Note that the preservation service is behind a firewall.
|
|
72
72
|
|
73
73
|
### Retrieve file signature (checksum) information
|
74
74
|
|
75
|
-
- `client.objects.
|
76
|
-
- `client.objects.checksums(druids: druids, format: 'json')` - returns info as json
|
75
|
+
- `client.objects.checksum(druid: 'oo000oo0000')` - returns info as array of hashes
|
77
76
|
|
78
77
|
### Retrieve individual files from preservation
|
79
78
|
|
@@ -8,11 +8,10 @@ module Preservation
|
|
8
8
|
class Client
|
9
9
|
# API calls that are about Preserved Objects
|
10
10
|
class Objects < VersionedApiService
|
11
|
-
# @param [
|
12
|
-
# @
|
13
|
-
|
14
|
-
|
15
|
-
post('objects/checksums', druids: druids, format: resp_format)
|
11
|
+
# @param [String] druid - with or without prefix: 'druid:bb123cd4567' OR 'bb123cd4567'
|
12
|
+
# @return [Hash] the checksums and filesize for the druid
|
13
|
+
def checksum(druid:)
|
14
|
+
get_json("objects/#{druid}/checksum", druid)
|
16
15
|
end
|
17
16
|
|
18
17
|
# @param [String] druid - with or without prefix: 'druid:bb123cd4567' OR 'bb123cd4567'
|
@@ -21,7 +21,7 @@ module Preservation
|
|
21
21
|
req.headers['Content-Type'] = 'application/json'
|
22
22
|
req.headers['Accept'] = 'application/json'
|
23
23
|
end
|
24
|
-
return JSON.parse(resp.body)
|
24
|
+
return with_indifferent_access_for(JSON.parse(resp.body)) if resp.success?
|
25
25
|
|
26
26
|
errmsg = ResponseErrorFormatter
|
27
27
|
.format(response: resp, object_id: object_id, client_method_name: caller_locations.first.label)
|
@@ -109,6 +109,16 @@ module Preservation
|
|
109
109
|
UnexpectedResponseError
|
110
110
|
end
|
111
111
|
end
|
112
|
+
|
113
|
+
def with_indifferent_access_for(obj)
|
114
|
+
if obj.is_a?(Array)
|
115
|
+
obj.map { |member| with_indifferent_access_for(member) }
|
116
|
+
elsif obj.is_a?(Hash)
|
117
|
+
obj.with_indifferent_access
|
118
|
+
else
|
119
|
+
obj
|
120
|
+
end
|
121
|
+
end
|
112
122
|
end
|
113
123
|
end
|
114
124
|
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: 7.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: 2023-
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -255,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: '0'
|
257
257
|
requirements: []
|
258
|
-
rubygems_version: 3.
|
258
|
+
rubygems_version: 3.3.7
|
259
259
|
signing_key:
|
260
260
|
specification_version: 4
|
261
261
|
summary: A thin client for getting info from SDR preservation.
|