Class: Aikido::Zen::Events::Attack

Inherits:
Aikido::Zen::Event show all
Defined in:
lib/aikido/zen/event.rb

Instance Attribute Summary collapse

Attributes inherited from Aikido::Zen::Event

#system_info, #time, #type

Instance Method Summary collapse

Constructor Details

#initialize(attack:, **opts) ⇒ Attack

Returns a new instance of Attack.



37
38
39
40
# File 'lib/aikido/zen/event.rb', line 37

def initialize(attack:, **opts)
  @attack = attack
  super(type: "detected_attack", **opts)
end

Instance Attribute Details

#attackObject (readonly)

Returns the value of attribute attack.



35
36
37
# File 'lib/aikido/zen/event.rb', line 35

def attack
  @attack
end

Instance Method Details

#as_jsonObject



42
43
44
45
46
47
# File 'lib/aikido/zen/event.rb', line 42

def as_json
  super.update(
    attack: @attack.as_json,
    request: @attack.context.request.as_json
  )
end