duracloud-client 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/duracloud/rest_methods.rb +5 -1
- data/lib/duracloud/version.rb +1 -1
- data/spec/unit/client_spec.rb +93 -93
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f466d1f97f6ec8082c7669205d859ddba431815f
|
4
|
+
data.tar.gz: 1f02e797ccfc52ba151b82f1e91a239e0a2b45a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92e83d00154ebce26a64b1eae288b27a338160957ca87b8066247d7590b5158adc06dd9b1651e51270fa0d18dadbe02cf2e6aff526b447085434f6fadcb974ca
|
7
|
+
data.tar.gz: 98af73a8dea342e6406b929dbc60faeb3abe30cd5c462ae8039cfedcb4aadc37b79eb6f8134c04b274a012ee3048ab197426ff318aff87dcc37c7631264686b1
|
@@ -130,8 +130,12 @@ module Duracloud
|
|
130
130
|
execute(http_method, url, **options, &block)
|
131
131
|
end
|
132
132
|
|
133
|
+
def escape_content_id(content_id)
|
134
|
+
content_id.gsub(/%/, "%25").gsub(/\#/, "%23")
|
135
|
+
end
|
136
|
+
|
133
137
|
def durastore_content(http_method, space_id, content_id, **options, &block)
|
134
|
-
url = [ space_id, content_id
|
138
|
+
url = [ space_id, escape_content_id(content_id) ].join("/")
|
135
139
|
durastore(http_method, url, **options, &block)
|
136
140
|
end
|
137
141
|
|
data/lib/duracloud/version.rb
CHANGED
data/spec/unit/client_spec.rb
CHANGED
@@ -9,77 +9,77 @@ module Duracloud
|
|
9
9
|
end
|
10
10
|
|
11
11
|
describe "get_spaces" do
|
12
|
-
|
12
|
+
it "works without a storeID" do
|
13
13
|
stub = stub_request(:get, "https://example.com/durastore/spaces")
|
14
14
|
subject.get_spaces
|
15
15
|
expect(stub).to have_been_requested
|
16
|
-
|
17
|
-
|
16
|
+
end
|
17
|
+
it "works with a storeID" do
|
18
18
|
stub = stub_request(:get, "https://example.com/durastore/spaces")
|
19
19
|
.with(query: {storeID: 1})
|
20
20
|
subject.get_spaces(storeID: 1)
|
21
21
|
expect(stub).to have_been_requested
|
22
|
-
|
22
|
+
end
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "get_space" do
|
26
|
-
|
26
|
+
it "works without a storeID" do
|
27
27
|
stub = stub_request(:get, "https://example.com/durastore/foo")
|
28
28
|
subject.get_space("foo")
|
29
29
|
expect(stub).to have_been_requested
|
30
|
-
|
31
|
-
|
30
|
+
end
|
31
|
+
it "works with a storeID" do
|
32
32
|
stub = stub_request(:get, "https://example.com/durastore/foo")
|
33
33
|
.with(query: {storeID: 1, prefix: "bar", maxResults: 50, marker: "item1"})
|
34
34
|
subject.get_space("foo", storeID: 1, prefix: "bar", maxResults: 50, marker: "item1")
|
35
35
|
expect(stub).to have_been_requested
|
36
|
-
|
36
|
+
end
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "create_space" do
|
40
|
-
|
40
|
+
it "works without a storeID" do
|
41
41
|
stub = stub_request(:put, "https://example.com/durastore/foo")
|
42
42
|
subject.create_space("foo")
|
43
43
|
expect(stub).to have_been_requested
|
44
|
-
|
45
|
-
|
44
|
+
end
|
45
|
+
it "works with a storeID" do
|
46
46
|
stub = stub_request(:put, "https://example.com/durastore/foo")
|
47
47
|
.with(query: {storeID: 1})
|
48
48
|
subject.create_space("foo", storeID: 1)
|
49
49
|
expect(stub).to have_been_requested
|
50
|
-
|
50
|
+
end
|
51
51
|
end
|
52
52
|
|
53
53
|
describe "delete_space" do
|
54
|
-
|
54
|
+
it "works without a storeID" do
|
55
55
|
stub = stub_request(:delete, "https://example.com/durastore/foo")
|
56
56
|
subject.delete_space("foo")
|
57
57
|
expect(stub).to have_been_requested
|
58
|
-
|
59
|
-
|
58
|
+
end
|
59
|
+
it "works with a storeID" do
|
60
60
|
stub = stub_request(:delete, "https://example.com/durastore/foo")
|
61
61
|
.with(query: {storeID: 1})
|
62
62
|
subject.delete_space("foo", storeID: 1)
|
63
63
|
expect(stub).to have_been_requested
|
64
|
-
|
64
|
+
end
|
65
65
|
end
|
66
66
|
|
67
67
|
describe "get_space_acls" do
|
68
|
-
|
68
|
+
it "works without a storeID" do
|
69
69
|
stub = stub_request(:head, "https://example.com/durastore/acl/foo")
|
70
70
|
subject.get_space_acls("foo")
|
71
71
|
expect(stub).to have_been_requested
|
72
|
-
|
73
|
-
|
72
|
+
end
|
73
|
+
it "works with a storeID" do
|
74
74
|
stub = stub_request(:head, "https://example.com/durastore/acl/foo")
|
75
75
|
.with(query: {storeID: 1})
|
76
76
|
subject.get_space_acls("foo", storeID: 1)
|
77
77
|
expect(stub).to have_been_requested
|
78
|
-
|
78
|
+
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "set_space_acls" do
|
82
|
-
|
82
|
+
it "works without a storeID" do
|
83
83
|
stub = stub_request(:post, "https://example.com/durastore/acl/foo")
|
84
84
|
.with(headers: {'x-dura-meta-acl-user0'=>'WRITE',
|
85
85
|
'x-dura-meta-acl-user1'=>'WRITE',
|
@@ -89,8 +89,8 @@ module Duracloud
|
|
89
89
|
'x-dura-meta-acl-user1'=>'WRITE',
|
90
90
|
'x-dura-meta-acl-group-curators'=>'READ'})
|
91
91
|
expect(stub).to have_been_requested
|
92
|
-
|
93
|
-
|
92
|
+
end
|
93
|
+
it "works with a storeID" do
|
94
94
|
stub = stub_request(:post, "https://example.com/durastore/acl/foo")
|
95
95
|
.with(headers: {'x-dura-meta-acl-user0'=>'WRITE',
|
96
96
|
'x-dura-meta-acl-user1'=>'WRITE',
|
@@ -102,63 +102,56 @@ module Duracloud
|
|
102
102
|
'x-dura-meta-acl-user1'=>'WRITE',
|
103
103
|
'x-dura-meta-acl-group-curators'=>'READ'})
|
104
104
|
expect(stub).to have_been_requested
|
105
|
-
|
105
|
+
end
|
106
106
|
end
|
107
107
|
|
108
108
|
describe "get_content" do
|
109
|
-
|
109
|
+
it "works without a storeID" do
|
110
110
|
stub = stub_request(:get, "https://example.com/durastore/foo/bar")
|
111
111
|
subject.get_content("foo", "bar")
|
112
112
|
expect(stub).to have_been_requested
|
113
|
-
}
|
114
|
-
it "escapes percent signs in the content id" do
|
115
|
-
stub = stub_request(:get, "https://example.com/durastore/foo/z/z/bar%252Fbaz")
|
116
|
-
subject.get_content("foo", "z/z/bar%2Fbaz")
|
117
|
-
expect(stub).to have_been_requested
|
118
113
|
end
|
119
|
-
|
114
|
+
it "works with a storeID" do
|
120
115
|
stub = stub_request(:get, "https://example.com/durastore/foo/bar")
|
121
116
|
.with(query: {storeID: 1})
|
122
117
|
subject.get_content("foo", "bar", storeID: 1)
|
123
118
|
expect(stub).to have_been_requested
|
124
|
-
|
119
|
+
end
|
120
|
+
it "escapes percent and pound signs in the content id" do
|
121
|
+
stub = stub_request(:get, "https://example.com/durastore/foo/z/z/bar%252Fbaz%23bang")
|
122
|
+
subject.get_content("foo", "z/z/bar%2Fbaz#bang")
|
123
|
+
expect(stub).to have_been_requested
|
124
|
+
end
|
125
125
|
end
|
126
126
|
|
127
127
|
describe "get_content_properties" do
|
128
|
-
|
128
|
+
it "works without a storeID" do
|
129
129
|
stub = stub_request(:head, "https://example.com/durastore/foo/bar")
|
130
130
|
subject.get_content_properties("foo", "bar")
|
131
131
|
expect(stub).to have_been_requested
|
132
|
-
}
|
133
|
-
it "escapes percent signs and spaces in the content id" do
|
134
|
-
stub = stub_request(:head, "https://example.com/durastore/foo/z/z/bar%252Fbaz%20spam%20eggs")
|
135
|
-
subject.get_content_properties("foo", "z/z/bar%2Fbaz spam eggs")
|
136
|
-
expect(stub).to have_been_requested
|
137
132
|
end
|
138
|
-
|
133
|
+
it "works with a storeID" do
|
139
134
|
stub = stub_request(:head, "https://example.com/durastore/foo/bar")
|
140
135
|
.with(query: {storeID: 1})
|
141
136
|
subject.get_content_properties("foo", "bar", storeID: 1)
|
142
137
|
expect(stub).to have_been_requested
|
143
|
-
|
138
|
+
end
|
139
|
+
it "escapes percent and pound signs and spaces in the content id" do
|
140
|
+
stub = stub_request(:head, "https://example.com/durastore/foo/z/z/bar%252Fbaz%20spam%20eggs%23bang")
|
141
|
+
subject.get_content_properties("foo", "z/z/bar%2Fbaz spam eggs#bang")
|
142
|
+
expect(stub).to have_been_requested
|
143
|
+
end
|
144
144
|
end
|
145
145
|
|
146
146
|
describe "set_content_properties" do
|
147
|
-
|
147
|
+
it "works without a storeID" do
|
148
148
|
stub = stub_request(:post, "https://example.com/durastore/foo/bar")
|
149
149
|
.with(headers: {'x-dura-meta-owner'=>'testuser'})
|
150
150
|
subject.set_content_properties("foo", "bar",
|
151
151
|
headers: {'x-dura-meta-owner'=>'testuser'})
|
152
152
|
expect(stub).to have_been_requested
|
153
|
-
}
|
154
|
-
it "escapes percent signs in the content id" do
|
155
|
-
stub = stub_request(:post, "https://example.com/durastore/foo/z/z/bar%252Fbaz")
|
156
|
-
.with(headers: {'x-dura-meta-owner'=>'testuser'})
|
157
|
-
subject.set_content_properties("foo", "z/z/bar%2Fbaz",
|
158
|
-
headers: {'x-dura-meta-owner'=>'testuser'})
|
159
|
-
expect(stub).to have_been_requested
|
160
153
|
end
|
161
|
-
|
154
|
+
it "works with a storeID" do
|
162
155
|
stub = stub_request(:post, "https://example.com/durastore/foo/bar")
|
163
156
|
.with(headers: {'x-dura-meta-owner'=>'testuser'},
|
164
157
|
query: {storeID: 1})
|
@@ -166,11 +159,18 @@ module Duracloud
|
|
166
159
|
headers: {'x-dura-meta-owner'=>'testuser'},
|
167
160
|
storeID: 1)
|
168
161
|
expect(stub).to have_been_requested
|
169
|
-
|
162
|
+
end
|
163
|
+
it "escapes percent and pound signs in the content id" do
|
164
|
+
stub = stub_request(:post, "https://example.com/durastore/foo/z/z/bar%252Fbaz%23%23bang")
|
165
|
+
.with(headers: {'x-dura-meta-owner'=>'testuser'})
|
166
|
+
subject.set_content_properties("foo", "z/z/bar%2Fbaz##bang",
|
167
|
+
headers: {'x-dura-meta-owner'=>'testuser'})
|
168
|
+
expect(stub).to have_been_requested
|
169
|
+
end
|
170
170
|
end
|
171
171
|
|
172
172
|
describe "store_content" do
|
173
|
-
|
173
|
+
it "works without a storeID" do
|
174
174
|
stub = stub_request(:put, "https://example.com/durastore/foo/bar")
|
175
175
|
.with(body: "File content",
|
176
176
|
headers: {
|
@@ -184,58 +184,58 @@ module Duracloud
|
|
184
184
|
'Content-MD5'=>'8bb2564936980e92ceec8a5759ec34a8'
|
185
185
|
})
|
186
186
|
expect(stub).to have_been_requested
|
187
|
-
|
188
|
-
it "
|
189
|
-
stub = stub_request(:put, "https://example.com/durastore/foo/
|
187
|
+
end
|
188
|
+
it "works with a storeID" do
|
189
|
+
stub = stub_request(:put, "https://example.com/durastore/foo/bar")
|
190
190
|
.with(body: "File content",
|
191
191
|
headers: {
|
192
192
|
'Content-Type'=>'text/plain',
|
193
193
|
'Content-MD5'=>'8bb2564936980e92ceec8a5759ec34a8'
|
194
|
-
}
|
195
|
-
|
194
|
+
},
|
195
|
+
query: {storeID: 1})
|
196
|
+
subject.store_content("foo", "bar",
|
196
197
|
body: "File content",
|
197
198
|
headers: {
|
198
199
|
'Content-Type'=>'text/plain',
|
199
200
|
'Content-MD5'=>'8bb2564936980e92ceec8a5759ec34a8'
|
200
|
-
}
|
201
|
+
},
|
202
|
+
storeID: 1)
|
201
203
|
expect(stub).to have_been_requested
|
202
204
|
end
|
203
|
-
|
204
|
-
stub = stub_request(:put, "https://example.com/durastore/foo/bar")
|
205
|
+
it "escapes percent and pound signs in the content id" do
|
206
|
+
stub = stub_request(:put, "https://example.com/durastore/foo/z/z/bar%252Fbaz%23bang")
|
205
207
|
.with(body: "File content",
|
206
208
|
headers: {
|
207
209
|
'Content-Type'=>'text/plain',
|
208
210
|
'Content-MD5'=>'8bb2564936980e92ceec8a5759ec34a8'
|
209
|
-
}
|
210
|
-
|
211
|
-
subject.store_content("foo", "bar",
|
211
|
+
})
|
212
|
+
subject.store_content("foo", "z/z/bar%2Fbaz#bang",
|
212
213
|
body: "File content",
|
213
214
|
headers: {
|
214
215
|
'Content-Type'=>'text/plain',
|
215
216
|
'Content-MD5'=>'8bb2564936980e92ceec8a5759ec34a8'
|
216
|
-
}
|
217
|
-
storeID: 1)
|
217
|
+
})
|
218
218
|
expect(stub).to have_been_requested
|
219
|
-
|
219
|
+
end
|
220
220
|
end
|
221
221
|
|
222
222
|
describe "delete_content" do
|
223
|
-
|
223
|
+
it "works without a storeID" do
|
224
224
|
stub = stub_request(:delete, "https://example.com/durastore/foo/bar")
|
225
225
|
subject.delete_content("foo", "bar")
|
226
226
|
expect(stub).to have_been_requested
|
227
|
-
}
|
228
|
-
it "escapes percent signs in the content id" do
|
229
|
-
stub = stub_request(:delete, "https://example.com/durastore/foo/z/z/bar%252Fbaz")
|
230
|
-
subject.delete_content("foo", "z/z/bar%2Fbaz")
|
231
|
-
expect(stub).to have_been_requested
|
232
227
|
end
|
233
|
-
|
228
|
+
it "works with a storeID" do
|
234
229
|
stub = stub_request(:delete, "https://example.com/durastore/foo/bar")
|
235
230
|
.with(query: {storeID: 1})
|
236
231
|
subject.delete_content("foo", "bar", storeID: 1)
|
237
232
|
expect(stub).to have_been_requested
|
238
|
-
|
233
|
+
end
|
234
|
+
it "escapes percent and pound signs in the content id" do
|
235
|
+
stub = stub_request(:delete, "https://example.com/durastore/foo/z/z/bar%252Fbaz%23bang")
|
236
|
+
subject.delete_content("foo", "z/z/bar%2Fbaz#bang")
|
237
|
+
expect(stub).to have_been_requested
|
238
|
+
end
|
239
239
|
end
|
240
240
|
|
241
241
|
describe "copy_content" do
|
@@ -248,73 +248,73 @@ module Duracloud
|
|
248
248
|
end
|
249
249
|
|
250
250
|
describe "get_audit_log" do
|
251
|
-
|
251
|
+
it "works without a storeID" do
|
252
252
|
stub = stub_request(:get, "https://example.com/durastore/audit/foo")
|
253
253
|
subject.get_audit_log("foo")
|
254
254
|
expect(stub).to have_been_requested
|
255
|
-
|
256
|
-
|
255
|
+
end
|
256
|
+
it "works with a storeID" do
|
257
257
|
stub = stub_request(:get, "https://example.com/durastore/audit/foo")
|
258
258
|
.with(query: {storeID: 1})
|
259
259
|
subject.get_audit_log("foo", storeID: 1)
|
260
260
|
expect(stub).to have_been_requested
|
261
|
-
|
261
|
+
end
|
262
262
|
end
|
263
263
|
|
264
264
|
describe "get_manifest" do
|
265
|
-
|
265
|
+
it "works without a storeID" do
|
266
266
|
stub = stub_request(:get, "https://example.com/durastore/manifest/foo")
|
267
267
|
subject.get_manifest("foo")
|
268
268
|
expect(stub).to have_been_requested
|
269
|
-
|
270
|
-
|
269
|
+
end
|
270
|
+
it "works with a storeID" do
|
271
271
|
stub = stub_request(:get, "https://example.com/durastore/manifest/foo")
|
272
272
|
.with(query: {format: "BAGIT", storeID: 1})
|
273
273
|
subject.get_manifest("foo", format: "BAGIT", storeID: 1)
|
274
274
|
expect(stub).to have_been_requested
|
275
|
-
|
275
|
+
end
|
276
276
|
end
|
277
277
|
|
278
278
|
describe "generate_manifest" do
|
279
|
-
|
279
|
+
it "works without a storeID" do
|
280
280
|
stub = stub_request(:post, "https://example.com/durastore/manifest/foo")
|
281
281
|
subject.generate_manifest("foo")
|
282
282
|
expect(stub).to have_been_requested
|
283
|
-
|
284
|
-
|
283
|
+
end
|
284
|
+
it "works with a storeID" do
|
285
285
|
stub = stub_request(:post, "https://example.com/durastore/manifest/foo")
|
286
286
|
.with(query: {format: "BAGIT", storeID: 1})
|
287
287
|
subject.generate_manifest("foo", format: "BAGIT", storeID: 1)
|
288
288
|
expect(stub).to have_been_requested
|
289
|
-
|
289
|
+
end
|
290
290
|
end
|
291
291
|
|
292
292
|
describe "get_bit_integrity_report" do
|
293
|
-
|
293
|
+
it "works without a storeID" do
|
294
294
|
stub = stub_request(:get, "https://example.com/durastore/bit-integrity/foo")
|
295
295
|
subject.get_bit_integrity_report("foo")
|
296
296
|
expect(stub).to have_been_requested
|
297
|
-
|
298
|
-
|
297
|
+
end
|
298
|
+
it "works with a storeID" do
|
299
299
|
stub = stub_request(:get, "https://example.com/durastore/bit-integrity/foo")
|
300
300
|
.with(query: {storeID: 1})
|
301
301
|
subject.get_bit_integrity_report("foo", storeID: 1)
|
302
302
|
expect(stub).to have_been_requested
|
303
|
-
|
303
|
+
end
|
304
304
|
end
|
305
305
|
|
306
306
|
describe "get_bit_integrity_report_properties" do
|
307
|
-
|
307
|
+
it "works without a storeID" do
|
308
308
|
stub = stub_request(:head, "https://example.com/durastore/bit-integrity/foo")
|
309
309
|
subject.get_bit_integrity_report_properties("foo")
|
310
310
|
expect(stub).to have_been_requested
|
311
|
-
|
312
|
-
|
311
|
+
end
|
312
|
+
it "works with a storeID" do
|
313
313
|
stub = stub_request(:head, "https://example.com/durastore/bit-integrity/foo")
|
314
314
|
.with(query: {storeID: 1})
|
315
315
|
subject.get_bit_integrity_report_properties("foo", storeID: 1)
|
316
316
|
expect(stub).to have_been_requested
|
317
|
-
|
317
|
+
end
|
318
318
|
end
|
319
319
|
|
320
320
|
describe "get_tasks" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duracloud-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chandek-Stark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|