Class: ApimaticCalculator::OAuth2

Inherits:
CoreLibrary::HeaderAuth
  • Object
show all
Defined in:
lib/apimatic_calculator/http/auth/o_auth2.rb

Overview

Utility class for OAuth 2 authorization and token management.

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ OAuth2

Initialization constructor.



16
17
18
19
20
21
22
# File 'lib/apimatic_calculator/http/auth/o_auth2.rb', line 16

def initialize(access_token)
  auth_params = {}
  @_access_token = access_token
  auth_params['Authorization'] = "Bearer #{@_access_token}" unless @_access_token.nil?

  super auth_params
end

Instance Method Details

#error_messageObject

Display error message on occurrence of authentication failure.



11
12
13
# File 'lib/apimatic_calculator/http/auth/o_auth2.rb', line 11

def error_message
  'BearerAuth: access_token is undefined.'
end