Class: AccountKit::API
- Inherits:
-
Object
- Object
- AccountKit::API
- Defined in:
- lib/account_kit/api.rb
Constant Summary collapse
- ME_URL =
"https://graph.accountkit.com/#{VERSION}/me".freeze
- GRANT_TYPE =
'authorization_code'.freeze
Instance Attribute Summary collapse
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#app_secret ⇒ Object
Returns the value of attribute app_secret.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #access_token(code) ⇒ Object
-
#initialize(options = {}) ⇒ API
constructor
A new instance of API.
- #me(access_token) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ API
Returns a new instance of API.
8 9 10 11 12 |
# File 'lib/account_kit/api.rb', line 8 def initialize( = {}) @app_id = [:app_id] || ENV['ACCOUNT_KIT_APP_ID'] @app_secret = [:app_secret] || ENV['ACCOUNT_KIT_APP_SECRET'] @version = [:version] || ENV['ACCOUNT_KIT_VERSION'] end |
Instance Attribute Details
#app_id ⇒ Object
Returns the value of attribute app_id.
6 7 8 |
# File 'lib/account_kit/api.rb', line 6 def app_id @app_id end |
#app_secret ⇒ Object
Returns the value of attribute app_secret.
6 7 8 |
# File 'lib/account_kit/api.rb', line 6 def app_secret @app_secret end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/account_kit/api.rb', line 6 def version @version end |
Instance Method Details
#access_token(code) ⇒ Object
14 15 16 17 |
# File 'lib/account_kit/api.rb', line 14 def access_token(code) uri = build_access_token_uri(code) send_payload(uri) end |
#me(access_token) ⇒ Object
19 20 21 22 |
# File 'lib/account_kit/api.rb', line 19 def me(access_token) uri = build_me_uri(access_token) send_payload(uri) end |