Sha256: 00071ca35683bfc0a3b936978203658194c742fd8cc13b614d7f636373755cc4

Contents?: true

Size: 1.48 KB

Versions: 34

Compression:

Stored size: 1.48 KB

Contents

module Fog
  module Storage
    class Rackspace
      class Real

        # Create a new object
        #
        # When passed a block, it will make a chunked request, calling
        # the block for chunks until it returns an empty string.
        # In this case the data parameter is ignored.
        #
        # ==== 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 #{}.
        # * block<~Proc> - chunker
        # @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

34 entries across 34 versions & 2 rubygems

Version Path
fog-maestrodev-1.19.0.20140212012611 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/rackspace/requests/storage/put_object.rb
fog-1.19.0 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131209090811 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/rackspace/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/rackspace/requests/storage/put_object.rb