Sha256: b5db36d53627f1c71e3101ba097c5815512514f143a6ddb1c1ad75fe0d166a13

Contents?: true

Size: 1.14 KB

Versions: 28

Compression:

Stored size: 1.14 KB

Contents

module Fog
  module Storage
    class Rackspace
      class Real
        # Create a new container
        #
        # ==== Parameters
        # * name<~String> - Name for container, should be < 256 bytes and must not contain '/'
        # @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_container(name, options={})
          request(
            :expects  => [201, 202],
            :method   => 'PUT',
            :headers => options,
            :path     => Fog::Rackspace.escape(name)
          )
        end
      end

      class Mock
        def put_container(name, options={})
          existed = ! mock_container(name).nil?
          container = add_container(name)
          options.keys.each do |k|
            container.meta[k] = options[k].to_s if k =~ /^X-Container-Meta/
          end

          response = Excon::Response.new
          response.status = existed ? 202 : 201
          response
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 4 rubygems

Version Path
ns-fog-1.22.8 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.7 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.6 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.23.0 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.4 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.3 lib/fog/rackspace/requests/storage/put_container.rb
ns-fog-1.22.2 lib/fog/rackspace/requests/storage/put_container.rb
fog-1.22.1 lib/fog/rackspace/requests/storage/put_container.rb