class Redata::S3Bucket
Public Class Methods
new()
click to toggle source
# File lib/redata/bucket.rb, line 3 def initialize s3 = Aws::S3::Resource.new @bucket = s3.bucket RED.s3['bucket'] end
Public Instance Methods
delete(file)
click to toggle source
# File lib/redata/bucket.rb, line 18 def delete(file) @bucket.object(file).delete if exist?(file) end
exist?(file)
click to toggle source
# File lib/redata/bucket.rb, line 14 def exist?(file) @bucket.object(file).exists? end
make_public(file, is_public)
click to toggle source
# File lib/redata/bucket.rb, line 22 def make_public(file, is_public) acl = is_public ? 'public-read' : 'private' @bucket.object(file).acl.put({:acl => acl}) if exist?(file) end
move(source, target)
click to toggle source
# File lib/redata/bucket.rb, line 8 def move(source, target) from = @bucket.object source to = @bucket.object target from.move_to to if from.exists? end