Created
May 14, 2011 18:15
-
-
Save rodreegez/972474 to your computer and use it in GitHub Desktop.
Retrive S3 files with Fog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fog' | |
con = Fog::Storage.new( | |
provider: 'AWS', | |
aws_secret_access_key: 'ABC123', | |
region: 'eu-west-1', | |
aws_access_key_id: 'ABC123' | |
) | |
=> Fog::AWS::Storage object | |
my_dir = con.directories.get('my-dir') | |
=> Fog::AWS::Storage::Directory | |
my_dir.files | |
=> Fog::AWS::Storage::Files # xml representation of file structure | |
my_dir.files.first.acl = 'public-read' | |
=> allow reading of file | |
my_dir.files.first.public_url | |
=> returns public URL of file. # file must be publicly readable. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment