module Finnegans::Core::Authentication
Constants
- AUTH_PATH
Private Instance Methods
auth_common_params()
click to toggle source
# File lib/finnegans/core/authentication.rb, line 39 def auth_common_params { client_id: @client_id, client_secret: @client_secret } end
auth_request(request_params)
click to toggle source
# File lib/finnegans/core/authentication.rb, line 31 def auth_request(request_params) response = request_call(AUTH_PATH, request_params) body = json_load(response.body) response.success? ? body : (raise AuthenticationError.new(body), body['error']) end
authenticated_param()
click to toggle source
# File lib/finnegans/core/authentication.rb, line 46 def authenticated_param # For the Finnegan API the params are case sensitive and this should be in all caps { "ACCESS_TOKEN" => @access_token } end
get_access_token()
click to toggle source
# File lib/finnegans/core/authentication.rb, line 10 def get_access_token request_params = { method: :get, params: auth_common_params.merge({grant_type: 'client_credentials'}) } auth_request(request_params) end
refresh_access_token()
click to toggle source
# File lib/finnegans/core/authentication.rb, line 19 def refresh_access_token request_params = { method: :get, params: auth_common_params.merge({ grant_type: 'refresh_token', refresh_token: @access_token }) } auth_request(request_params) end