ApontadorOauth2
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'
And then execute:
$ bundle
Or install it yourself as:
$ gem install apontador_oauth2
Usage Examples
Get Token with app trusted:
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:
credentials = {
:client_id => "12345", :client_secret => "54321",
:url => "https://api.apontador.com.br/v2/",
:username => "johndoe@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:
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 => "john doe", :email => "johndoe@example.com", :password => "johndoe12345"}
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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request