Skip to content

Instantly share code, notes, and snippets.

@tekwiz
Created September 2, 2009 16:29
Show Gist options
  • Save tekwiz/179808 to your computer and use it in GitHub Desktop.
Save tekwiz/179808 to your computer and use it in GitHub Desktop.
Ruby Snippets for CloudFiles
require 'rubygems'
require 'cloudfiles'
require 'activesupport'
CF_USERNAME = ''
CF_API_KEY = ''
CONTAINER = ''
# Connect
cf = CloudFiles::Connection.new(CF_USERNAME, CF_API_KEY)
# List All Containers
puts "CF Containers"
cf.containers.each {|c| puts " * #{c}"}
# List All Objects in a Container
puts "CF #{CONTAINER}"
c = cf.container(CONTAINER)
c.objects.each {|o| puts " * #{o}"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment