Class: TCellAgent::SensorEvents::TCellFingerprintSensorEvent

Inherits:
TCellSensorEvent
  • Object
show all
Defined in:
lib/tcell_agent/sensor_events/sensor.rb

Instance Attribute Summary

Attributes inherited from TCellSensorEvent

#ensure, #flush, #send

Instance Method Summary collapse

Methods inherited from TCellSensorEvent

#bucket_key, #calculateOffset

Constructor Details

#initialize(request, session_id, user_id = nil) ⇒ TCellFingerprintSensorEvent



71
72
73
74
75
76
# File 'lib/tcell_agent/sensor_events/sensor.rb', line 71

def initialize(request, session_id, user_id=nil)
    super("fingerprint")
    @raw_request = request
    @raw_session_id = session_id
    @user_id = user_id
end

Instance Method Details

#post_processObject



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/tcell_agent/sensor_events/sensor.rb', line 77

def post_process
    if !(@raw_request.headers.key?("HTTP_USER_AGENT"))
        raise "User Agent not Found!"
    end 
    self["ua"] = @raw_request.headers["HTTP_USER_AGENT"]
    self["ip"] = @raw_request.remote_ip
    hmac_key = Util.getHmacKey()
    self["sid"] = Util.hmac(@raw_session_id, hmac_key)
    if @user_id
        self["uid"] = @user_id
    end
end