Class: Rapid::Baps::Responses::Handlers::LoginResult

Inherits:
Services::Responses::Handler show all
Defined in:
lib/ury_rapid/baps/responses/handlers/system.rb

Overview

Handler for BAPS responses carrying login responses.

Defined Under Namespace

Modules: LoginErrors

Instance Method Summary collapse

Methods inherited from Services::Responses::Handler

#initialize, #kill_if_exists

Methods inherited from Services::Handler

def_targets, #initialize, register_into, #targets, targets?, use_poster

Constructor Details

This class inherits a constructor from Rapid::Services::Responses::Handler

Instance Method Details

#continueObject


73
74
75
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 73

def continue
  @parent.
end

#die(code, string) ⇒ Object


77
78
79
80
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 77

def die(code, string)
  log(:fatal, "BAPS login failed: #{string}, code #{code}.")
  EventMachine.stop
end

#ok?(code) ⇒ Boolean

Returns:

  • (Boolean)

69
70
71
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 69

def ok?(code)
  code == LoginErrors::SUCCESS
end

#runObject


64
65
66
67
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 64

def run
  code = @response.subcode
  ok?(code) ? continue : die(code, @response.details)
end