Parent

RightAws::S3Generator::Key

Attributes

bucket[R]
name[R]

Public Class Methods

new(bucket, name, meta_headers={}) click to toggle source
# File lib/s3/right_s3.rb, line 1053
def initialize(bucket, name, meta_headers={})
  @bucket       = bucket
  @name         = name.to_s
  @meta_headers = meta_headers
  raise 'Key name can not be empty.' if @name.blank?
end

Public Instance Methods

delete(expires=nil, headers={}) click to toggle source

Generate link to delete key.

bucket.delete(2.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket/logs%2Ftoday%2F1.log?Signature=4...D&Expires=1180820032&AWSAccessKeyId=1...2
# File lib/s3/right_s3.rb, line 1080
def delete(expires=nil,  headers={})
  @bucket.s3.interface.delete_link(@bucket.to_s, @name, expires,  headers)
end
full_name(separator='/') click to toggle source

Return a full S# name (bucket/key).

key.full_name #=> 'my_awesome_bucket/cool_key'
# File lib/s3/right_s3.rb, line 1040
def full_name(separator='/')
  "#{@bucket.to_s}#{separator}#{@name}"
end
get(expires=nil, headers={}) click to toggle source

Generate link to GET key data.

bucket.get('logs/today/1.log', 1.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket/logs%2Ftoday%2F1.log?Signature=h...M%3D&Expires=1180820032&AWSAccessKeyId=1...2
# File lib/s3/right_s3.rb, line 1072
def get(expires=nil, headers={})
  @bucket.s3.interface.get_link(@bucket.to_s, @name, expires, headers)
end
head(expires=nil, headers={}) click to toggle source

Generate link to head key.

bucket.head(2.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket/logs%2Ftoday%2F1.log?Signature=4...D&Expires=1180820032&AWSAccessKeyId=1...2
# File lib/s3/right_s3.rb, line 1088
def head(expires=nil,  headers={})
  @bucket.s3.interface.head_link(@bucket.to_s, @name, expires,  headers)
end
put(expires=nil, headers={}) click to toggle source

Generate link to PUT key data.

puts bucket.put('logs/today/1.log', '123', 2.hour) #=> https://s3.amazonaws.com:443/my_awesome_bucket/logs%2Ftoday%2F1.log?Signature=B...D&Expires=1180820032&AWSAccessKeyId=1...2
# File lib/s3/right_s3.rb, line 1064
def put(expires=nil, headers={})
  @bucket.put(@name.to_s, @meta_headers, expires, headers)
end
to_s() click to toggle source
# File lib/s3/right_s3.rb, line 1032
def to_s
  @name
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.