Class: S3Client
- Inherits:
-
Object
- Object
- S3Client
- Defined in:
- lib/wormholio/s3_client.rb
Class Method Summary collapse
Class Method Details
.download(creds, local_path, filename) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/wormholio/s3_client.rb', line 13 def self.download(creds,local_path,filename) p 'S3 DOWNLOAD' connect(creds) file = @wormholio_bucket.objects.find("#{creds['dir_path']}#{filename}") File.open("#{local_path}#{filename}", 'w') do |f| f.write("#{file.content(true)}") end end |
.upload(creds, local_path, filename) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/wormholio/s3_client.rb', line 5 def self.upload(creds,local_path,filename) p 'S3 UPLOAD' connect(creds) file = @wormholio_bucket.objects.build("#{creds['dir_path']}#{filename}") file.content = open("#{local_path}#{filename}") file.save end |