Module: Hudu::Authentication
- Included in:
- API
- Defined in:
- lib/hudu/authentication.rb
Overview
Deals with authentication flow and stores it within global configuration
Instance Method Summary collapse
-
#login(options = {}) ⇒ Object
Authorize to the Hudu portal and return access_token.
Instance Method Details
#login(options = {}) ⇒ Object
Authorize to the Hudu portal and return access_token
9 10 11 12 13 14 15 16 17 |
# File 'lib/hudu/authentication.rb', line 9 def login( = {}) raise ArgumentError, "Accesstoken/api-key not set" unless api_key .merge!({ headers: { "x-api-key": api_key }}) # only api key needed # will do sanitty check if token if valid get('/api/v1/api_info') rescue Faraday::Error => e raise AuthenticationError, e end |