Class: S3Bucket

Inherits:
Object
  • Object
show all
Defined in:
lib/tigre-client/s3_bucket.rb

Instance Method Summary collapse

Constructor Details

#initialize(bucket) ⇒ S3Bucket

Returns a new instance of S3Bucket.



3
4
5
6
# File 'lib/tigre-client/s3_bucket.rb', line 3

def initialize(bucket)
  @s3     = RightAws::S3.new(Tigre::FogConfig::AWS_KEY, Tigre::FogConfig::AWS_SECRET)
  @bucket = @s3.bucket(bucket)
end

Instance Method Details

#send_file(file, file_name = nil) ⇒ Object



8
9
10
11
# File 'lib/tigre-client/s3_bucket.rb', line 8

def send_file(file, file_name=nil)
  file_name ||= file[:filename]
  @bucket.put(file_name, IO.binread(file[:tempfile]))
end