lib/fog/rackspace/requests/storage/head_containers.rb in fog-maestrodev-1.19.0.20140212012611 vs lib/fog/rackspace/requests/storage/head_containers.rb in fog-maestrodev-1.20.0.20140305101305

- old
+ new

@@ -1,8 +1,9 @@ module Fog module Storage class Rackspace + class Real # List number of containers and total bytes stored # # ==== Returns @@ -22,8 +23,26 @@ :query => {'format' => 'json'} ) end end + + class Mock + def head_containers + bytes_used = data.values.map { |c| c.bytes_used }.inject(0) { |a, b| a + b } + container_count = data.size + object_count = data.values.map { |c| c.objects.size }.inject(0) { |a, b| a + b } + + response = Excon::Response.new + response.status = 204 + response.headers = { + 'X-Account-Bytes-Used' => bytes_used, + 'X-Account-Container-Count' => container_count, + 'X-Account-Object-Count' => object_count + }.merge(account_meta) + response + end + end + end end end