Module: WrAPI::Authentication
- Included in:
- API
- Defined in:
- lib/wrapi/authentication.rb
Overview
Deals with authentication flow and stores it within global configuration following attributes should be available:
username
password
access_token
token_type
refresh_token
token_expires
Instance Method Summary collapse
-
#api_auth(path, options = {}) ⇒ Object
Authorize to the portal and return access_token.
-
#api_refresh(path, token) ⇒ Object
Return an access token from authorization.
Instance Method Details
#api_auth(path, options = {}) ⇒ Object
Authorize to the portal and return access_token
13 14 15 16 17 18 |
# File 'lib/wrapi/authentication.rb', line 13 def api_auth(path, = {}) params = api_access_token_params.merge() response = post(path, params) # return access_token api_process_token(response.body) end |
#api_refresh(path, token) ⇒ Object
Return an access token from authorization
21 22 23 24 25 26 27 |
# File 'lib/wrapi/authentication.rb', line 21 def api_refresh(path, token) params = { refreshToken: token } response = post(path, params) # return access_token api_process_token(response.body) end |