Sha256: 9b7e640ea6c7e10abeaa30fa711df7226096e11f9c12e15953884512e65391aa

Contents?: true

Size: 1.32 KB

Versions: 58

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module Storage
    class InternetArchive
      class Real

        # Delete an object from S3
        #
        # @param bucket_name [String] Name of bucket containing object to delete
        # @param object_name [String] Name of object to delete
        #
        # @return [Excon::Response] response:
        #   * status [Integer] - 204
        #
        # @see http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectDELETE.html

        def delete_object(bucket_name, object_name, options = {})
          path = CGI.escape(object_name)

          headers = options
          request({
            :expects    => 204,
            :headers    => headers,
            :host       => "#{bucket_name}.#{@host}",
            :idempotent => true,
            :method     => 'DELETE',
            :path       => path
          })
        end

      end

      class Mock # :nodoc:all

        def delete_object(bucket_name, object_name, options = {})
          response = Excon::Response.new
          if bucket = self.data[:buckets][bucket_name]
            response.status = 204

            bucket[:objects].delete(object_name)
          else
            response.status = 404
            raise(Excon::Errors.status_error({:expects => 204}, response))
          end
          response
        end

      end
    end
  end
end

Version data entries

58 entries across 58 versions & 4 rubygems

Version Path
fog-1.22.0 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-1.21.0 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-1.20.0 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-1.19.0 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/internet_archive/requests/storage/delete_object.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/internet_archive/requests/storage/delete_object.rb