Class: Square::OAuth2

Inherits:
CoreLibrary::HeaderAuth
  • Object
show all
Defined in:
lib/square/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.



11
12
13
14
15
16
17
# File 'lib/square/http/auth/o_auth2.rb', line 11

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.



6
7
8
# File 'lib/square/http/auth/o_auth2.rb', line 6

def error_message
  'BearerAuth: access_token is undefined.'
end