README.md in tumbz-0.0.1 vs README.md in tumbz-0.0.2

- old
+ new

@@ -5,21 +5,17 @@ ## Installation Add this line to your application's Gemfile: ```ruby -gem 'tumbz' +gem 'tumbz', :git => "git://github.com/remiprev/tumbz.git", :branch => "master" ``` And then execute: $ bundle -Or install it yourself as: - - $ gem install tumbz - ## Usage First, you must define a `configure` block with your API key: ```ruby @@ -31,34 +27,52 @@ That’s it! You’ll then be able to use : ```ruby Tumbz::User.find("remi") # => #<Tumbz::User(users/4f0e32936edcb2000100029d) id="4f0e32936edcb2000100029d" username="remi" profile_url="http://tum.bz/u/remi" firstname="Rémi" lastname="Prévost"…> + +Tumbz::Product.search(:q => "office", :cat => "tv") +# => [#<Tumbz::Product(products/50b4caaac042690002010e1c) id="50b4caaac042690002010e1c" cat="tv" url="http://tum.bz/tv/50b4caaac042690002010e1c/the-offic..." title="The Office (US)" artist=nil external_id="73244" img_thumb=nil img_cover=""…>] ``` Other modules are: * `Tumbz::Comment` * `Tumbz::Like` * `Tumbz::Review` * `Tumbz::PartnerLookup` * `Tumbz::Product` * `Tumbz::User` +* `Tumbz::UserSuggestion` The API wrapper is powered by [Her](https://github.com/remiprev/her), so most of [its documentation](https://github.com/remiprev/her) will be helpful. ## OAuth Support for OAuth-authenticated calls is supported, but very premitive (not quite thread-safe). Here’s how it works: ```ruby Tumbz::User.sign_in!("<email>", "<password>") -# => true (next calls will be made as the authenticated user) +# => "abc123edgfh" (next calls will be made as the authenticated user using this key) -Tumbz::Review.create(:product_external_id => "tt0458339", :positive => "1", :cat => "movie") +review = Tumbz::Review.create(:product_external_id => "tt0458339", :positive => "1", :cat => "movie") # => #<Tumbz::Review(reviews/50b9ebd7a9d29c000200af7c) id="50b9ebd7a9d29c000200af7c" positive=true text=""…> Tumbz::User.sign_out! +# => true (next calls will be made anonymously) + +review = Tumbz::Review.create(:product_external_id => "tt0458339", :positive => "1", :cat => "movie") +# => #<Tumbz::Review(reviews)> +review.errors +# => ["Token is invalid or expired"] +``` + +You don’t need to use `User.sign_in!` each time, you can also set the `access_token` manually (eg. if you store it in a session): + +```ruby +Tumbz.access_token = "abc123edgfh" +review = Tumbz::Review.create(:product_external_id => "tt0458339", :positive => "1", :cat => "movie") +# => #<Tumbz::Review(reviews/50b9ebd7a9d29c000200af7c) id="50b9ebd7a9d29c000200af7c" positive=true text=""…> ``` ## Contributing 1. Fork it