Class: Zumobi::S3

Inherits:
Object
  • Object
show all
Defined in:
lib/zumobi/amazon_s3.rb

Class Method Summary collapse

Class Method Details

.establish_s3_connectionObject



3
4
5
6
7
# File 'lib/zumobi/amazon_s3.rb', line 3

def self.establish_s3_connection
    config = Zumobi::S3.config()
    AWS::S3::Base.establish_connection!( :access_key_id => config.access_key_id, :secret_access_key => config.secret_access_key )
    puts "Connected to s3"
end

.save_in_s3(data, options = Hash.new) ⇒ Object



9
10
11
12
13
14
# File 'lib/zumobi/amazon_s3.rb', line 9

def self.save_in_s3(data, options=Hash.new)
    establish_s3_connection
    config = Zumobi::S3.config()
    puts "Sending file to http://#{config.bucket}/#{config.path}"
    AWS::S3::S3Object.store(config.path, data, config.bucket, options)
end

.save_in_s3_with_path(data, path, options = Hash.new) ⇒ Object



16
17
18
19
20
21
# File 'lib/zumobi/amazon_s3.rb', line 16

def self.save_in_s3_with_path(data, path, options=Hash.new)
    establish_s3_connection
    config = Zumobi::S3.config()
    puts "Sending file to http://#{config.bucket}/#{path}"
    AWS::S3::S3Object.store(path, data, config.bucket, options)
end