Sha256: 04c1647fff3aa4e18ceb2ebcce1b762bbca7cd03654944025670cf40c447a9a9

Contents?: true

Size: 1.32 KB

Versions: 40

Compression:

Stored size: 1.32 KB

Contents

module Fog
  module Storage
    class OpenStack
      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
        #
        def put_object(container, object, data, options = {}, &block)
          if block_given?
            params = { :request_block => block }
            headers = options
          else
            data = Fog::Storage.parse_data(data)
            headers = data[:headers].merge!(options)
            params = { :body => data[:body] }
          end

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

          request(params)
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 5 rubygems

Version Path
fog-openstack-0.1.10 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.9 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.8 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.7 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.6 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.5 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.4 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.3 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.2 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.1 lib/fog/openstack/requests/storage/put_object.rb
fog-openstack-0.1.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.37.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.36.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.35.0 lib/fog/openstack/requests/storage/put_object.rb
fog-2.0.0.pre.0 lib/fog/openstack/requests/storage/put_object.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/openstack/requests/storage/put_object.rb
fog-1.34.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.33.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.32.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.31.0 lib/fog/openstack/requests/storage/put_object.rb