I am new to writing Rails and APIs. I need some help with S3 storage solution. Here\'s my problem.
I am writing an API for an iOS app where the users login with the
The above answers use the old aws-sdk-v1 gem rather than the new aws-sdk-resources version 2.
The new way is:
aws_resource = Aws::S3::Resource::new
aws_resource.bucket('your_bucket').object('your_object_key').presigned_url(:get, expires_in: 1*20.minutes)
where your_object_key is the path to your file. If you need to look that up, you would use something like:
s3 = Aws::S3::Client::new
keys = []
s3.list_objects(bucket: 'your_bucket', prefix: 'your_path').contents.each { |e|
keys << e.key
}
That information was startlingly difficult to dig up, and I almost just gave up and used the older gem.
http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Object.html#presigned_url-instance_method