Class: HasuraHandler::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/hasura_handler/authenticator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(headers) ⇒ Authenticator

Returns a new instance of Authenticator.



7
8
9
10
# File 'lib/hasura_handler/authenticator.rb', line 7

def initialize(headers)
  @headers = headers
  @response = {}
end

Instance Attribute Details

#error_messageObject

Returns the value of attribute error_message.



4
5
6
# File 'lib/hasura_handler/authenticator.rb', line 4

def error_message
  @error_message
end

#headersObject (readonly)

Returns the value of attribute headers.



3
4
5
# File 'lib/hasura_handler/authenticator.rb', line 3

def headers
  @headers
end

#responseObject

Returns the value of attribute response.



4
5
6
# File 'lib/hasura_handler/authenticator.rb', line 4

def response
  @response
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


12
13
14
15
16
17
18
19
20
# File 'lib/hasura_handler/authenticator.rb', line 12

def success?
  begin
    authenticate
  ensure
    return false if @response.blank?
  end

  @response.present? || @error_message.blank?
end