https://github.com/eder/apontador_oauth2
https://github.com/eder/apontador_oauth2
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/eder/apontador_oauth2
- Owner: eder
- License: mit
- Created: 2013-09-17T22:49:10.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-06-06T05:03:52.000Z (about 12 years ago)
- Last Synced: 2024-04-30T04:05:18.577Z (about 2 years ago)
- Language: Ruby
- Size: 434 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/eder/apontador_oauth2)
[](http://badge.fury.io/rb/apontador_oauth2)
# 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:
```ruby
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 => "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:
``` 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 => "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
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request