CloudApp API

Build Status Code Climate Coverage Status

A simple Ruby wrapper for the CloudApp API. Uses HTTParty with a simple ActiveResource-like interface.

Two interfaces are provided for interacting with the CloudApp API. The first is a ActiveResource-like interface, directly calling methods on the Drop and Account classes. The second option is to interact through a Client interface.


To install as a Gem:

sudo gem install cloudapp_api

(Version 0.5.0 ends compaitibility with Ruby 1.8.7. If you need 1.8.7 support, you can still use version 0.4.0 of this gem.)


Authentication is necessary for most actions, the only exceptions being when creating a new Account or querying a specific Drop.

CloudApp.authenticate "[email protected]", "password"


Usage via the Drop class

# Find a single drop by it's slug
@drop = CloudApp::Drop.find "2wr4"

# Get a list of all drops
@drops = CloudApp::Drop.all

# Create a new bookmark
@drop = CloudApp::Drop.create :bookmark, :name => "CloudApp", :redirect_url => ""

# Create multiple bookmarks
bookmarks = [
  { :name => "Authur Dent", :redirect_url => "" },
  { :name => "Zaphod Beeblebrox", :redirect_url => "" }
@drops = CloudApp::Drop.create :bookmarks, bookmarks

# Upload a file
@drop = CloudApp::Drop.create :upload, :file => "/path/to/image.png"
@drop = CloudApp::Drop.create :upload, :file => "/path/to/image.png", :private => true

# Rename a file
CloudApp::Drop.update "", :name => "Big Screenshot"

# Set a drop's privacy
CloudApp::Drop.update "", :private => true

# Delete a drop
CloudApp::Drop.delete ""

# Recover a deleted drop
CloudApp::Drop.recover ""

Usage via the class instance

# Rename a file
@drop.update :name => "Big Screenshot"

# Set the drop's privacy
@drop.update :private => true

# Delete a drop

# Recover a deleted drop

Drops via a Client instance

# Find a single drop by it's slug
drop = @client.drop "2wr4"

# Get a list of all drops
drops = @client.all

# Create a new bookmark
drop = @client.bookmark "", "CloudApp"

# Create multiple new bookmarks
bookmarks = [
  { :name => "Authur Dent", :redirect_url => "" },
  { :name => "Zaphod Beeblebrox", :redirect_url => "" }
drops = @client.bookmark bookmarks

# Upload a file
drop = @client.upload "/path/to/image.png"
drop = @client.upload "/path/to/image.png", :private => true

# Rename a file
@client.rename "2wr4", "Big Screenshot"

# Set a drop's privacy
@client.privacy "2wr4", true

# Delete an drop
@client.delete "2wr4"

# Recover a deleted drop
@client.recover "2wr4"

Account examples

# Create a CloudApp account
@account = CloudApp::Account.create :email => "[email protected]", :password => "towel"

# View account details
@account = CloudApp::Account.find

# Forgot password
CloudApp::Account.reset :email => "[email protected]"

# Change default security
@account.update :private_items => false

# Change email
@account.update :email => "[email protected]", :current_password => "towel"

# Change password
@account.update :password => "happy frood", :current_password => "towel"

# Set custom domain
@account.update :domain => "", :domain_home_page => ""

# View account stats

Gift cards

# View gift card details
@gift = CloudApp::GiftCard.find "ABC123"

# Apply the gift card
CloudApp::GiftCard.redeem "ABC123"
  # or

What's next on the to-do list?

  • Refactor the Client interface so can be used with all of the API

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Author & Contributors

Copyright (c) 2010 Aaron Russell. See LICENSE for details.