Mosso Cloud Files

This is a Ruby interface into the http://rackspace.com/ http://www.mosso.com/cloudfiles.jsp 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.

Important Notice

This is NOT the official Ruby Cloud Files API. There are two branches in this project: offical and master. The official branch contains an unmodified official 1.3.0 Ruby API released by Rackspace. This branch (master) contains a slightly enhanced version as indicated in the Enhancements section below.

  • Releases from the official branch will be tagged with a prefix of "official-"
  • The Ruby Gem is the latest tagged version of the enhanced version.

Requirements

  • Ruby >= 1.8
  • mime-types
  • archive-tar-minitar
  • nokogiri
  • hoe
  • rcov

Installation

Examples

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

    require 'rubygems'
  require 'cloudfiles'

  # Log into the Cloud Files system
  cf = CloudFiles::Connection.new(USERNAME, API_KEY)

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

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

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

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

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

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

Enhancements

  • Pipe standard input ($stdin) straight to the container. [Jon Stacey in 1.3.1]
    • Pass the string "STDIN" as the data for a write action. See the CFBackup project for a real-world example.

Authors

Initial work by Major Hayden [email protected]

Subsequent work by H. Wade Minter [email protected]

Further enhancements by Jon Stacey

Copyright (c) 2009, Rackspace US, Inc. See LICENSE for details.