Class: Reach5::API
- Inherits:
-
Object
- Object
- Reach5::API
- Defined in:
- lib/reach5/api.rb
Overview
Handles all calls to Reach5’s API.
Instance Method Summary collapse
-
#get_access_token ⇒ Object
Get a new access token.
-
#get_profiles(page: 1, count: 10) ⇒ Object
List profiles.
-
#post_login(provider:, provider_token:, provider_secret: nil, user_agent: nil) ⇒ Object
Collects and stores profile data from an Auth provider.
Instance Method Details
#get_access_token ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/reach5/api.rb', line 15 def get_access_token params = { client_key: Reach5.configuration.client_key, client_secret: Reach5.configuration.client_secret, } request = HTTP.get("#{host}/api/v1/access_token", params: params) request.parse end |
#get_profiles(page: 1, count: 10) ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/reach5/api.rb', line 58 def get_profiles(page: 1, count: 10) params = { access_token: access_token, page: page, count: count, } HTTP.get("#{host}/api/v1/profile", params: params).parse end |
#post_login(provider:, provider_token:, provider_secret: nil, user_agent: nil) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/reach5/api.rb', line 35 def post_login(provider:, provider_token:, provider_secret: nil, user_agent: nil) params = { provider: provider, provider_token: provider_token, provider_secret: provider_secret, user_agent: user_agent, } HTTP.post("#{host}/api/v1/login", params: params).parse end |