README.md in apontador_oauth2-0.1.3 vs README.md in apontador_oauth2-0.1.5

- old
+ new

@@ -1,10 +1,9 @@ [![Build Status](https://travis-ci.org/eder/apontador_oauth2.png?branch=master)](https://travis-ci.org/eder/apontador_oauth2) +[![Gem Version](https://badge.fury.io/rb/apontador_oauth2.png)](http://badge.fury.io/rb/apontador_oauth2) # ApontadorOauth2 - -TODO: Write a gem description - +Ruby client for the OAuth 2.0 to site Apontador, still in process of development. ## Installation Add this line to your application's Gemfile: gem 'apontador_oauth2' @@ -15,12 +14,57 @@ Or install it yourself as: $ gem install apontador_oauth2 -## Usage +## Usage Examples + +Get Token with app trust: +```ruby -TODO: Write usage instructions here +credentials = { + :client_id => "12345", :client_secret => "54321", + :url => "https://api.apontador.com.br/v2/" +} +client = ApontadorOauth2::Client.new(credentials) + +client.token +#=> one-number-token-valid +``` + +Get token with user authenticated: +``` ruby +credentials = { + :client_id => "12345", :client_secret => "54321", + :url => "https://api.apontador.com.br/v2/", + :username => "jhondoe@example.com", + :password => "123456", + :grant_type => "password" +} +client = ApontadorOauth2::Client.new(credentials) +client.token +#=> one-number-token-valid-authenticate-be-user +``` +Register new user with token app of trust: +``` ruby +credentials = { + :client_id => "12345", :client_secret => "54321", + :url => "https://api.apontador.com.br/v2/" +} +client = ApontadorOauth2::Client.new(credentials) +new_user = ApontadorOauth2::User.new({:token => client.token}) + +user = {:name => "jhon Doe", :email => "jhondoe@example.com", :password => "jhondoe12345"} +new_user.register_user_in_apontador(user) +#=> nil +``` + +##Supported Ruby Versions + +This library aims to support and is tested against the following Ruby implementations: +Ruby 1.9.2 +Ruby 1.9.3 +Ruby 2.0.0 ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`)