Class: Rapid::Baps::Responses::Handlers::Log

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

Overview

Handler for dealing with BAPS system notifications that Rapid logs but otherwise ignores.

Constant Summary collapse

DETAILS_SYM =
{
  Codes::System::CLIENT_CHANGE => :client,
  Codes::System::LOG_MESSAGE => :message
}
TYPE_MESSAGE =
{
  Codes::System::CLIENT_CHANGE => 'Client disconnected',
  Codes::System::CLIENT_CHANGE + 1 => 'Client connected',
  Codes::System::LOG_MESSAGE => 'BAPS says'
}

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

#detailsObject


21
22
23
24
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 21

def details
  symbol = DETAILS_SYM[@response.code]
  @response[symbol]
end

#runObject


13
14
15
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 13

def run
  log(:info, "#{type_message}: #{details}")
end

#type_messageObject


17
18
19
# File 'lib/ury_rapid/baps/responses/handlers/system.rb', line 17

def type_message
  TYPE_MESSAGE[@response.code + @response.subcode]
end