plntr-fakes3 1.0.0.pre.10alpha29 → 1.0.0.pre.10alpha33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fakes3/server.rb +32 -6
- data/lib/fakes3/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f0e9a469b82f105ed857e8d6864ef896f72bcdbac8ba3e58ebce5f111711aaa
|
4
|
+
data.tar.gz: d813f49a103bd4bd188614845c3334986a1fd3251be5b120db0e4043f9ec60e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c79dfb5b59e9eba9317349f79b78e282475a7886d73a2c689c481f55b723e6a6242f2bf7b02eb17399e8b27d74890ce1868be5be1b38504b1580b3865f747c45
|
7
|
+
data.tar.gz: 43130d209c04b5af118ee352fc82d18443d8878da375cc9c2c16cd3c2642d490e5d86b296ece7465c82d33deb5d98670641ce0bcc41ae2ab0d4a23bfbe1b7425
|
data/lib/fakes3/server.rb
CHANGED
@@ -328,7 +328,7 @@ module FakeS3
|
|
328
328
|
case s_req.type
|
329
329
|
when Request::DELETE_OBJECT
|
330
330
|
bucket_obj = @store.get_bucket(s_req.bucket)
|
331
|
-
@store.delete_object(bucket_obj,s_req.object
|
331
|
+
@store.delete_object(bucket_obj,s_req.object)
|
332
332
|
response.status = 204
|
333
333
|
response.body = ""
|
334
334
|
when Request::DELETE_BUCKET
|
@@ -338,7 +338,23 @@ module FakeS3
|
|
338
338
|
when Request::DELETE_OBJECTS
|
339
339
|
warn 'Request::DELETE_OBJECTS'
|
340
340
|
warn "bucket: #{s_req.bucket}"
|
341
|
-
|
341
|
+
bucket_obj = @store.get_bucket(s_req.bucket)
|
342
|
+
objects = parse_delete_objects s_req.webrick_request
|
343
|
+
responses = objects.collect do |obj|
|
344
|
+
warn "process key=#{obj[:key]} version_id=#{obj[:version_id]}"
|
345
|
+
# @store.delete_object(bucket_obj, obj.key)
|
346
|
+
"<Deleted><Key>#{obj[:key]}</Key></Deleted>"
|
347
|
+
end
|
348
|
+
response.status = 200
|
349
|
+
response.body = <<-eos.strip
|
350
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
351
|
+
<DeleteResult>
|
352
|
+
#{responses.join '\n'}
|
353
|
+
</DeleteResult>
|
354
|
+
eos
|
355
|
+
warn '--- RESPONSE ---'
|
356
|
+
warn response.body
|
357
|
+
warn '--- RESPONSE END ---'
|
342
358
|
warn ''
|
343
359
|
end
|
344
360
|
|
@@ -542,11 +558,21 @@ module FakeS3
|
|
542
558
|
end
|
543
559
|
|
544
560
|
def parse_delete_objects(request)
|
545
|
-
|
546
|
-
request.body { |chunk|
|
547
|
-
warn " ::: BODY ::: (type=#{
|
548
|
-
warn
|
561
|
+
objects_xml = ""
|
562
|
+
request.body { |chunk| objects_xml << chunk }
|
563
|
+
warn " ::: BODY ::: (type=#{objects_xml.class})"
|
564
|
+
warn objects_xml
|
549
565
|
warn " ::: END BODY :::"
|
566
|
+
|
567
|
+
# TODO: improve parsing xml
|
568
|
+
objects_xml = objects_xml.scan(/<Object>.*?<\/Object>/)
|
569
|
+
|
570
|
+
objects_xml.collect do |obj|
|
571
|
+
{
|
572
|
+
key: obj[/<Key>(.+)<\/Key>/, 1],
|
573
|
+
version_id: obj[/<VersionId>(.+)<\/VersionId>/, 1]
|
574
|
+
}
|
575
|
+
end
|
550
576
|
end
|
551
577
|
|
552
578
|
def dump_request(request)
|
data/lib/fakes3/version.rb
CHANGED