Class: PresignedUpload::Adapter::Aws
- Defined in:
- lib/presigned_upload/adapter/aws.rb
Overview
The ‘Aws` class is an adapter for interacting with the Amazon Simple Storage Service (S3) using the AWS SDK. It inherits from `Adapter::Base` and implements methods for generating presigned URLs, uploading files, and deleting files.
Instance Method Summary collapse
-
#delete_file(key) ⇒ void
Deletes the file with the specified key from the storage.
-
#presigned_url(key, method, expires_in) ⇒ String
Generates a presigned URL for the specified key, HTTP method, and expiration time.
-
#upload_file(file, key) ⇒ void
Uploads the specified file to the storage with the given key.
Methods inherited from Base
Constructor Details
This class inherits a constructor from PresignedUpload::Adapter::Base
Instance Method Details
#delete_file(key) ⇒ void
This method returns an undefined value.
Deletes the file with the specified key from the storage.
42 43 44 |
# File 'lib/presigned_upload/adapter/aws.rb', line 42 def delete_file(key) bucket.object(key).delete end |
#presigned_url(key, method, expires_in) ⇒ String
Generates a presigned URL for the specified key, HTTP method, and expiration time.
22 23 24 |
# File 'lib/presigned_upload/adapter/aws.rb', line 22 def presigned_url(key, method, expires_in) bucket.object(key).presigned_url(method, expires_in: expires_in) end |
#upload_file(file, key) ⇒ void
This method returns an undefined value.
Uploads the specified file to the storage with the given key.
32 33 34 35 |
# File 'lib/presigned_upload/adapter/aws.rb', line 32 def upload_file(file, key) object = bucket.object(key) object.upload_file(file) end |