README.md in cloudapp_api-0.0.3 vs README.md in cloudapp_api-0.1.0

- old
+ new

@@ -1,84 +1,120 @@ # CloudApp API A simple Ruby wrapper for the [CloudApp API](http://support.getcloudapp.com/faqs/developers/api). Uses [HTTParty](http://github.com/jnunemaker/httparty) with a simple ActiveResource-like interface. -## TODO +Two interfaces are provided for interacting with the CloudApp API. The first is a ActiveResource-like interface, directly calling methods on the Item and Account class. The second option is to interact through a Client interface. -* Add tests -* Improve the docs +* [Familiarise yourself with the documentation](http://rubydoc.info/github/aaronrussell/cloudapp_api/) ## Installation To install as a Gem: sudo gem install cloudapp_api -## Usage +## Authentication -### Authentication +Authentication is necessary for most actions, the only exceptions being when creating a new Account or querying a specific Item. -Authentication isn't necessary if you are just attempting to find an individual item. However, if you are trying to create, delete or list all items, you must authenticate. - CloudApp.authenticate "email@address.com", "password" -### Initialize client interface +## Item examples -If you are using the client interface, you must create a client instance. +* Documentation - {CloudApp::Item} - # Optionally you can pass a hash containing :username and :password to authenticate. - - client = CloudApp::Client.new opts +--- -### View an item by short URL +### Usage via the Item class + # Find a single item by it's slug + item = CloudApp::Item.find "2wr4" + + # Get a list of all items + items = CloudApp::Item.all + + # Create a new bookmark + item = CloudApp::Item.create :bookmark, :name => "CloudApp", :redirect_url => "http://getcloudapp.com" + + # Upload a file + item = CloudApp::Item.create :upload, :file => "/path/to/image.png" + + # Rename a file + CloudApp::Item.update "http://my.cl.ly/items/1912565", :name => "Big Screenshot" + + # Set an items privacy + CloudApp::Item.update "http://my.cl.ly/items/1912565", :private => true + + # Delete an item + CloudApp::Item.delete "http://my.cl.ly/items/1912565" - short_url = "19xM" +### Usage via an Item instance + # Rename a file + @item.update :name => "Big Screenshot" + + # Set an items privacy + @item.update :private => true + + # Delete an item + @tem.delete + +## Usage via a Client instance + +* Documentation - {CloudApp::Client} + +--- + + # Create a Client instance + @client = CloudApp::Client.new - @item = client.item short_url + # Find a single item by it's slug + item = @client.item "2wr4" - # or .. + # Get a list of all items + items = @client.all - @item = CloudApp::Item.find short_url - -### List items + # Create a new bookmark + item = @client.bookmark "http://getcloudapp.com", "CloudApp" - # Allowed params - # :page => 1 # page number starting at 1 - # :per_page => 5 # number of items per page - # :type => "image" # filter items by type - # (image, bookmark, text, archive, audio, video, or unknown) - # :deleted => true # show trashed items + # Upload a file + item = @client.upload "/path/to/image.png" - @items = client.items params + # Rename a file + @client.rename "2wr4", "Big Screenshot" - # or .. + # Set an items privacy + @client.privacy "2wr4", true - @items = CloudApp::Item.all params + # Delete an item + @client.delete "2wr4" -### Create a bookmark +## Account examples - @item = client.bookmark url, name +* Documentation - {CloudApp::Account} + +--- + + # Create a CloudApp account + @account = CloudApp::Account.create :email => "arthur@dent.com", :password => "towel" - # or .. + # Forgot password + CloudApp::Account.reset :email => "arthur@dent.com" - @item = CloudApp::Item.create :bookmark, {:name => name, :redirect_url => url} + # View details of authenticated account + @account = CloudApp::Account.find -### Upload a file - - @item = client.upload file_name + # Change default security + @account.update :private_items => false - # or .. + # Change email + @account.update :email => "ford@prefect.com", :current_password => "towel" - @item = CloudApp::Item.create :upload, {:file => file_name} + # Change password + @account.update :password => "happy frood", :current_password => "towel" -### Delete an item - - client.delete short_url + # Set custom domain + @account.update :domain => "dent.com", :domain_home_page => "http://hhgproject.org" - # or .. - - @item.delete ## Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. @@ -88,10 +124,9 @@ * Send me a pull request. Bonus points for topic branches. ## Author & Contributors * [Aaron Russell](http://www.aaronrussell.co.uk) -* [Wade West](http://github.com/wadewest) ## Copyright Copyright (c) 2010 Aaron Russell. See LICENSE for details.