class Sqreen::Rules::SignupTrackCB

Public Class Methods

new(*args) click to toggle source
Calls superclass method Sqreen::Rules::RuleCB::new
# File lib/sqreen/rules/signup_track_cb.rb, line 13
def initialize(*args)
  super(*args)
  @overtimeable = false
end

Public Instance Methods

pre(_instance, args, _budget) click to toggle source
# File lib/sqreen/rules/signup_track_cb.rb, line 18
def pre(_instance, args, _budget)
  authentication_keys = args.first
  ip = framework.client_ip
  category = 'sdk-signup'

  if authentication_keys.empty?
    Sqreen.log.debug { "#{category} from #{ip} but keys empty" }
    return
  end

  payload = { keys: authentication_keys.to_a, ip: ip }

  record_observation(category, JSON.dump(payload), 1)
  advise_action(nil)
end