Class: DataMigrater::S3
- Inherits:
-
Object
- Object
- DataMigrater::S3
- Defined in:
- lib/data_migrater/s3.rb
Instance Method Summary collapse
- #delete ⇒ Object
- #download ⇒ Object
-
#initialize(bucket, credentials, csv_path) ⇒ S3
constructor
A new instance of S3.
Constructor Details
#initialize(bucket, credentials, csv_path) ⇒ S3
Returns a new instance of S3.
7 8 9 10 11 12 13 |
# File 'lib/data_migrater/s3.rb', line 7 def initialize(bucket, credentials, csv_path) @bucket = bucket @credentials = default_credentials.merge(credentials) @csv_path = csv_path ::Aws.config.update @credentials end |
Instance Method Details
#delete ⇒ Object
15 16 17 |
# File 'lib/data_migrater/s3.rb', line 15 def delete client.delete_object end |
#download ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/data_migrater/s3.rb', line 19 def download client.head_object client.get_object .merge(response_target: @csv_path) rescue Aws::S3::Errors::NotFound [] end |