Module: SdbDal::S3::CallingFormat

Defined in:
lib/sdb_dal/s3.rb

Overview

class for storing calling format constants

Constant Summary collapse

REGULAR =
0
SUBDOMAIN =
1
VANITY =

http://<vanity_domain>/key – vanity_domain resolves to s3.amazonaws.com

2

Class Method Summary collapse

Class Method Details

.build_url_base(protocol, server, port, bucket, format) ⇒ Object

build the url based on the calling format, and bucket



357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/sdb_dal/s3.rb', line 357

def CallingFormat.build_url_base(protocol, server, port, bucket, format)
  build_url_base = "#{protocol}://"
  if bucket.empty?
    build_url_base << "#{server}:#{port}"
  elsif format == SUBDOMAIN
    build_url_base << "#{bucket}.#{server}:#{port}"
  elsif format == VANITY
    build_url_base << "#{bucket}:#{port}"
  else
    build_url_base << "#{server}:#{port}/#{bucket}"
  end
  return build_url_base
end