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/hp/requests/storage/delete_object.rb
2012-04-02 15:30:42 -04:00

44 lines
1.1 KiB
Ruby

module Fog
module Storage
class HP
class Real
# Delete an existing object
#
# ==== Parameters
# * container<~String> - Name of container to delete
# * object<~String> - Name of object to delete
#
def delete_object(container, object)
response = request(
:expects => 204,
:method => 'DELETE',
:path => "#{Fog::HP.escape(container)}/#{Fog::HP.escape(object)}"
)
response
end
end
class Mock # :nodoc:all
def delete_object(container_name, object_name, options = {})
response = Excon::Response.new
if container = self.data[:containers][container_name]
if (object = container[:objects][object_name])
response.status = 204
container[:objects].delete(object_name)
else
raise Fog::Storage::HP::NotFound
end
else
raise Fog::Storage::HP::NotFound
end
response
end
end
end
end
end