Class: CsvHelper::Aws
Constant Summary collapse
- S3_BUCKET =
APP_CONFIG['s3_bucket']
- S3_FOLDER =
APP_CONFIG['s3_folder'] || 'results'
Constants inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#filename, #filepath, #initialize
Constructor Details
This class inherits a constructor from CsvHelper::Base
Instance Method Details
#store! ⇒ Object
17 18 19 20 21 22 |
# File 'lib/csv_helper/aws.rb', line 17 def store! Pester.s3.retry do obj = AwsS3.resource.bucket(S3_BUCKET).object(key) obj.upload_file(filepath) end end |
#url ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/csv_helper/aws.rb', line 6 def url Pester.s3.retry do obj = AwsS3.resource.bucket(S3_BUCKET).object(key) if obj.exists? obj.presigned_url(:get, response_content_disposition: "attachment; filename=result_#{@result_id}.csv", expires_in: 3600) else nil end end end |