1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/rackspace/requests/storage/head_container.rb

45 lines
1.2 KiB
Ruby
Raw Normal View History

module Fog
module Storage
class Rackspace
class Real
2009-10-26 20:56:08 -04:00
# List number of objects and total bytes stored
#
# ==== Parameters
# * container<~String> - Name of container to retrieve info for
#
# ==== Returns
# * response<~Excon::Response>:
2009-10-26 20:56:08 -04:00
# * headers<~Hash>:
# * 'X-Container-Object-Count'<~String> - Count of containers
# * 'X-Container-Bytes-Used'<~String> - Bytes used
# @raise [Fog::Storage::Rackspace::NotFound] - HTTP 404
# @raise [Fog::Storage::Rackspace::BadRequest] - HTTP 400
# @raise [Fog::Storage::Rackspace::InternalServerError] - HTTP 500
# @raise [Fog::Storage::Rackspace::ServiceError]
2009-10-26 20:56:08 -04:00
def head_container(container)
request(
2009-10-26 20:56:08 -04:00
:expects => 204,
:method => 'HEAD',
:path => Fog::Rackspace.escape(container),
:query => {'format' => 'json'}
2009-10-26 20:56:08 -04:00
)
end
end
2013-12-16 17:13:27 -05:00
class Mock
def head_container(container)
c = mock_container! container
2013-12-16 17:13:27 -05:00
response = Excon::Response.new
response.status = 204
response.headers = c.to_headers
2013-12-16 17:13:27 -05:00
response
end
end
2009-10-26 20:56:08 -04:00
end
end
end