Class: School21::AuthorizationHeader

Inherits:
CoreLibrary::HeaderAuth
  • Object
show all
Defined in:
lib/school21/auth/authorization_header.rb

Instance Method Summary collapse

Constructor Details

#initialize(bearer_auth_credentials) ⇒ AuthorizationHeader

Returns a new instance of AuthorizationHeader.



9
10
11
12
13
14
15
16
17
18
# File 'lib/school21/auth/authorization_header.rb', line 9

def initialize(bearer_auth_credentials)
  auth_params = {}

  @access_token = bearer_auth_credentials.access_token unless
    bearer_auth_credentials.nil? || bearer_auth_credentials.access_token.nil?

  auth_params['Authorization'] = "Bearer #{@access_token}" unless @access_token.nil?

  super(auth_params)
end

Instance Method Details

#error_messageObject



5
6
7
# File 'lib/school21/auth/authorization_header.rb', line 5

def error_message
  'BearerAuth: access_token is undefined.'
end