Method: Fog::Storage::Google::Mock#delete_object

Defined in:
lib/fog/google/requests/storage/delete_object.rb

#delete_object(bucket_name, object_name) ⇒ Object

[View source]

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fog/google/requests/storage/delete_object.rb', line 30

def delete_object(bucket_name, object_name)
  response = Excon::Response.new
  if bucket = self.data[:buckets][bucket_name]
    if object = bucket[:objects][object_name]
      response.status = 204
      bucket[:objects].delete(object_name)
    else
      response.status = 404
      raise(Excon::Errors.status_error({:expects => 204}, response))
    end
  else
    response.status = 404
    raise(Excon::Errors.status_error({:expects => 204}, response))
  end
  response
end