Giter Site home page Giter Site logo

ruby-cloudfiles's Introduction

Rackspace Cloud Files

Description

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 = CloudFiles::Connection.new(:username => "MY_USERNAME", :api_key => "MY_API_KEY")

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

cf = CloudFiles::Connection.new("MY_USERNAME","MY_API_KEY")

Installation

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

gem sources -a http://gemcutter.org/

sudo gem install cloudfiles

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

config.gem "cloudfiles"

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 => "MY_USERNAME", :api_key => "MY_API_KEY")

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

# Or, if you want to access CloudFiles from within the Rackspace network
cf = CloudFiles::Connection.new(:username => "MY_USERNAME", :api_key => "MY_API_KEY", :snet => true)

# 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

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

# 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"

Authors

Initial work by Major Hayden <[email protected]>

Subsequent work by H. Wade Minter <[email protected]> and Dan Prince <[email protected]>

License

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

ruby-cloudfiles's People

Contributors

minter avatar slyphon avatar sasimpson avatar technoweenie avatar bantic avatar tobowers avatar niels avatar coreyward avatar dillona avatar cjwoodwardtest avatar bluefuton avatar cvx avatar edmundsalvacion avatar francois avatar jcallicoat avatar smathy avatar xinuc avatar tfe avatar xaviershay avatar

Watchers

Cafebabe avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.