class FakeAWS::S3::Operations::PutBucket

Public Class Methods

new(root_directory, request) click to toggle source
# File lib/fake_aws/s3/operations/put_bucket.rb, line 7
def initialize(root_directory, request)
  @root_directory = root_directory
  @request        = request
end

Public Instance Methods

call() click to toggle source
# File lib/fake_aws/s3/operations/put_bucket.rb, line 12
def call
  return bucket_already_exists_response if bucket_on_disk.exists?

  bucket_on_disk.create
  success_response
end

Private Instance Methods

bucket_already_exists_response() click to toggle source
# File lib/fake_aws/s3/operations/put_bucket.rb, line 25
def bucket_already_exists_response
  Responses::Error.new("BucketAlreadyExists", "BucketName" => @request.bucket)
end
bucket_on_disk() click to toggle source
# File lib/fake_aws/s3/operations/put_bucket.rb, line 29
def bucket_on_disk
  @bucket_on_disk ||= BucketOnDisk.new(@root_directory, @request.bucket)
end
success_response() click to toggle source
# File lib/fake_aws/s3/operations/put_bucket.rb, line 21
def success_response
  Responses::Empty.new
end