Class: Rookout::ComWs::CommandHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rookout/com_ws/command_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(agent_com, augs_manager) ⇒ CommandHandler

Returns a new instance of CommandHandler.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rookout/com_ws/command_handler.rb', line 6

def initialize agent_com, augs_manager
  agent_com.on "Com::Rookout::InitialAugsCommand" do |initial_augs|
    Config.update_config initial_augs.sdk_configuration
    augs = initial_augs.augs.map { |aug_json| JSON.parse aug_json }
    augs_manager.initialize_augs augs
  end
  agent_com.on "Com::Rookout::AddAugCommand" do |command|
    augs_manager.add_aug JSON.parse(command.aug_json)
  end

  agent_com.on "Com::Rookout::RemoveAugCommand" do |command|
    augs_manager.remove_aug command.aug_id
  end
end