Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby API for Cloud Files

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 CHANGELOG
Octocat-spinner-32 CONTRIBUTORS
Octocat-spinner-32 COPYING
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO
Octocat-spinner-32 cloudfiles.gemspec

Rackspace Cloud Files


This is a Ruby interface into the Rackspace Cloud Files service. Cloud Files is reliable, scalable and affordable web-based storage hosting for backing up and archiving all your static content. Cloud Files is the first and only cloud service that leverages a tier one CDN provider to create such an easy and complete storage-to-delivery solution for media content.

Upgrade Gotchas

As of gem version 1.4.8, the connection method has changed from positional arguments to a hash of options. This is the new style:

cf = => "MY_USERNAME", :api_key => "MY_API_KEY")

This is the old style, which still works but is deprecated:



This source is available on Github and the gem is available on Gemcutter. To install it, do

gem sources -a

sudo gem install cloudfiles

To use it in a Rails application, add the following information to your config/environment.rb

config.gem "cloudfiles"


See the class definitions for documentation on specific methods and operations.

require 'rubygems'
require 'cloudfiles'

# Log into the Cloud Files system
cf = => "MY_USERNAME", :api_key => "MY_API_KEY")

# Or, if you want to access the United Kingdom cloud installations, there's a handy constant:
cf = => "MY_USERNAME", :api_key => "MY_API_KEY", :auth_url => CloudFiles::AUTH_UK)

# Get a listing of all containers under this account
=> ["backup", "Books", "cftest", "test", "video", "webpics"]

# Access a specific container
container = cf.container('test')

# See how many objects are under this container
=> 3

# Upload a file
object = container.create_object 'filename.txt', false
object.write file

# List the objects
=> ["bigfile.txt", "new.txt", "test.txt"]

# Select an object
object = container.object('test.txt')

# Get that object's data
=> "This is test data"


Initial work by Major Hayden <>

Subsequent work by H. Wade Minter <> and Dan Prince <>


See COPYING for license information. Copyright © 2011, Rackspace US, Inc.

Something went wrong with that request. Please try again.