Class: Yabeda::Rack::Attack::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/yabeda/rack/attack/notifier.rb

Instance Method Summary collapse

Instance Method Details

#instrument(event_type, request:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/yabeda/rack/attack/notifier.rb', line 7

def instrument(event_type, request:)
  # backwards compatibility issues
  # https://github.com/rack/rack-attack/blob/2257f008763b405f6a1515b460f80ed5d0f06c2c/lib/rack/attack.rb#L42-L43
  case event_type
  when 'throttle.rack_attack'
    track_throttled(request)
  when 'track.rack_attack'
    track_tracked(request)
  when 'safelist.rack_attack'
    track_safelisted(request)
  when 'blocklist.rack_attack'
    track_blacklisted(request)
  end
end