Sha256: f91ad420e9129a9ad6694bcf2bdcba44799e6d127a9f29642392c46cec135f36
Contents?: true
Size: 905 Bytes
Versions: 18
Compression:
Stored size: 905 Bytes
Contents
class TestTrack::NotifyAssignmentJob attr_reader :visitor_id, :assignment def initialize(opts) @visitor_id = opts.delete(:visitor_id) @assignment = opts.delete(:assignment) %w(visitor_id assignment).each do |param_name| raise "#{param_name} must be present" if send(param_name).blank? end raise "unknown opts: #{opts.keys.to_sentence}" if opts.present? end def perform tracking_result = track unless assignment.feature_gate? TestTrack::Remote::AssignmentEvent.create!( visitor_id: visitor_id, split_name: assignment.split_name, context: assignment.context, mixpanel_result: tracking_result ) end end private def track return "failure" unless TestTrack.enabled? result = TestTrack.analytics.track(TestTrack::AnalyticsEvent.new(visitor_id, assignment)) result ? "success" : "failure" end end
Version data entries
18 entries across 18 versions & 1 rubygems