Sample Ruby Application for Cloud Files

From Connection to Objects

In the sample command below, use your Rackspace Cloud account username
and API key, where indicated by 'UsernameGoesHere' and 'APIKeyGoesHere' in
the following command. For information about how to find your API key,
see View and reset your API key.

#!/usr/bin/env ruby
require 'rubygems'
require 'cloudfiles'
# Log in to the Cloud Files system
cf = CloudFiles::Connection.new('UsernameGoesHere','APIKeyGoesHere')
#Create a Container
container = cf.create_container('ContainerNameGoesHere')
#Create an Object
object = container.create_object('ObjectNameGoesHere')
# Write Data to an Object
object.write('DataGoesHere')