Sha256: 4f7e6cefcc3457c9b9a2bdd68286a6e5ff51426520cccc7f4912c555699d2034

Contents?: true

Size: 1.25 KB

Versions: 5

Compression:

Stored size: 1.25 KB

Contents

module Fog
  module Storage
    class Rackspace
      class Real

        # Create a new object
        #
        # ==== Parameters
        # * container<~String> - Name for container, should be < 256 bytes and must not contain '/'
        # * object<~String> - Name for object
        # * data<~String|File> - data to upload
        # * options<~Hash> - config headers for object. Defaults to {}.
        # @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]
        def put_object(container, object, data, options = {}, &block)
          data = Fog::Storage.parse_data(data)
          headers = data[:headers].merge!(options)

          params = block_given? ? { :request_block => block } : { :body => data[:body] }

          params.merge!(
            :expects    => 201,
            :idempotent => !params[:request_block],
            :headers    => headers,
            :method     => 'PUT',
            :path       => "#{Fog::Rackspace.escape(container)}/#{Fog::Rackspace.escape(object)}"
          )

          request(params)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
fog-maestrodev-1.15.0.20130927082724 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/rackspace/requests/storage/put_object.rb
fog-1.15.0 lib/fog/rackspace/requests/storage/put_object.rb
gapinc-fog-1.14.0 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/rackspace/requests/storage/put_object.rb