Module: PictureHandler::Uploader::FileSystem::S3
- Defined in:
- lib/picture_handler/uploader/file_system/s3.rb
Instance Method Summary collapse
-
#delete_all_with_file_system ⇒ Object
————————– # —— DELETE —— # ————————– #.
-
#write_file(image, path_to_write) ⇒ Object
————————– # —— WRITE —— # ————————– #.
Instance Method Details
#delete_all_with_file_system ⇒ Object
————————– # —— DELETE —— # ————————– #
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/picture_handler/uploader/file_system/s3.rb', line 25 def delete_all_with_file_system infos = info s3_client = Aws::S3::Client.new # Get all the objects to delete and delete then in ONE http request paths_to_delete = infos[:paths] s3_client.delete_objects( bucket: PictureHandler.configuration.s3_bucket, delete: { objects: paths_to_delete } ) end |
#write_file(image, path_to_write) ⇒ Object
————————– # —— WRITE —— # ————————– #
12 13 14 15 16 17 18 19 |
# File 'lib/picture_handler/uploader/file_system/s3.rb', line 12 def write_file(image, path_to_write) s3_client = Aws::S3::Client.new s3_resource = Aws::S3::Resource.new( client: s3_client ) s3_resource.bucket(PictureHandler.configuration.s3_bucket).object(path_to_write).upload_file(image.path) end |