Path: | README.txt |
Last Update: | Tue Sep 26 11:28:55 BST 2006 |
This is a first pass at a Ruby library for talking to Amazon’s S3 service.
It is less complete than my previous effort (townx.org/blog/elliot/s3_rails), but more solid, more elegant, and with a test suite (which uses RSpec - see rubyforge.org/projects/rspec).
To use it from inside your Ruby script:
require 's33r'
By the way, I’ve tested this on Linux, but not on Windows or Mac.
To get the most from s33r, you will need:
require 'lib/s33r' include S33r # initialise a client instance from a config file client = Client.init('/home/you/.s33r') # create a bucket called 'some-outlandish-name' client.create_bucket('some-outlandish-name') # show the contents of the bucket client.list_buckets.body # put something into the bucket c.put_file('somefile.jpg', 'some-outlandish-name')
Note that the simple Client class is not sophisticated and returns raw requests (list_buckets returns a HTTPResponse object with attached body, for example). I tend to use NamedBucket instead, which provides a simplified interface to a single bucket. This saves having to pass the bucket name to every method call, and parses bucket listings into an object representation.
If you want to see a full example program which uses the library, have a look at bin/s3cli.rb. This is a simple command line client which you can use to post a file to S3 and email a link to the file to someone. Useful for sending big files to people without clogging their email inbox with enormous files. It is also intended as a demonstration of how to use the library. Full instructions are included at the top of the file.
Thanks for bug reports to: Keaka (keakaj.com/products.htm)