Sha256: 4c5c11069686c2befd53e490aac420b99ba25ec50e9403fc2e4d43e84b12c607

Contents?: true

Size: 1.32 KB

Versions: 39

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

39 entries across 39 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131209090811 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131206115947 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131205181604 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/openstack/requests/storage/put_object.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/openstack/requests/storage/put_object.rb
fog-1.18.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.17.0 lib/fog/openstack/requests/storage/put_object.rb
fog-1.16.0 lib/fog/openstack/requests/storage/put_object.rb