README.md in account_kit-0.1.1 vs README.md in account_kit-0.1.2
- old
+ new
@@ -1,5 +1,7 @@
+[![Code Climate](https://codeclimate.com/github/Coffa/account_kit/badges/gpa.svg)](https://codeclimate.com/github/Coffa/account_kit)
+
# AccountKit
A light-weight Ruby API client for [Facebook Account Kit](https://developers.facebook.com/docs/accountkit) with no dependency.
A demo of the Account Kit can be found [here](https://www.facebook.com/FacebookforDevelopers/videos/10153620979588553/).
## Installation
@@ -24,35 +26,30 @@
To work with Account Kit API, you need to provide Facebook App ID, Account Kit App Secret. If you don't specify an api version, the gem will call v1.0. You can also specify which version you want to use:
```
AccountKit.configure do |config|
- config.app_id = '1234566789'
- config.app_secret = 'abcdefghijklm'
+ config.app_id = '1234566789'
+ config.app_secret = 'abcdefghijklm'
config.api_version = 'v1.0'
end
```
### API
-We currently only supports [Authorization Code Flow](https://developers.facebook.com/docs/accountkit/accesstokens). Support for Client Access Token Flow will come in later versions.
+If you turn off Enable Client Access Token Flow and use [Authorization Code Flow](https://developers.facebook.com/docs/accountkit/accesstokens), you need to provide the authorization code after user authenticate with Account Kit in order to get an access token:
-To get access token, you need to provide the authorization code you get after user authenticate with Account Kit:
-
```
-response = AccountKit.access_token(authorization_code)
-json_response = JSON.parse(response)
-access_token = json_response['access_token']
+response = JSON.parse(AccountKit.access_token(authorization_code).body)
+access_token = response['access_token']
```
+If you turn on Enable Client Access Token Flow, you should already have an access token after user authenticate. To get account information, use the access token to get user's email or phone number:
-The response contains user's access token, use this token to get user's email or phone number:
-
```
-response = AccountKit.me(access_token)
-json_response = JSON.parse(response)
-email = json_response[:email][:address]
-phone_code = json_response[:phone][:country_prefix]
-phone_number = json_response[:phone][:national_number]
+response = JSON.parse(AccountKit.me(access_token).body)
+email = response[:email][:address]
+phone_code = response[:phone][:country_prefix]
+phone_number = response[:phone][:national_number]
```
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.