Class: Adhoq::Storage::S3
- Inherits:
-
FogStorage
- Object
- FogStorage
- Adhoq::Storage::S3
- Defined in:
- lib/adhoq/storage/s3.rb
Instance Method Summary collapse
- #direct_download? ⇒ Boolean
- #get_url(report) ⇒ Object
- #identifier ⇒ Object
-
#initialize(bucket, s3_options = {}) ⇒ S3
constructor
A new instance of S3.
Methods inherited from FogStorage
Constructor Details
#initialize(bucket, s3_options = {}) ⇒ S3
Returns a new instance of S3.
6 7 8 9 10 11 |
# File 'lib/adhoq/storage/s3.rb', line 6 def initialize(bucket, = {}) @bucket = bucket @direct_download = .delete(:direct_download) @direct_download_options = .delete(:direct_download_options) || @s3 = Fog::Storage.new({provider: 'AWS'}.merge()) end |
Instance Method Details
#direct_download? ⇒ Boolean
13 14 15 |
# File 'lib/adhoq/storage/s3.rb', line 13 def direct_download? @direct_download end |
#get_url(report) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/adhoq/storage/s3.rb', line 21 def get_url(report) get_raw(report.identifier).url( 1.minutes.from_now.to_i, @direct_download_options.call(report) ) end |
#identifier ⇒ Object
17 18 19 |
# File 'lib/adhoq/storage/s3.rb', line 17 def identifier "s3://#{@bucket}" end |