Sha256: 851a49925138f6acadd6593d18917a3bc02c431548a76d8729c7135db803cd41
Contents?: true
Size: 791 Bytes
Versions: 2
Compression:
Stored size: 791 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 TestTrack::Remote::AssignmentEvent.create!( visitor_id: visitor_id, split_name: assignment.split_name, context: assignment.context, mixpanel_result: track ) end private def track return "failure" unless TestTrack.enabled? result = TestTrack.analytics.track_assignment(visitor_id, assignment) result ? "success" : "failure" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
test_track_rails_client-3.0.1 | app/models/test_track/notify_assignment_job.rb |
test_track_rails_client-3.0.0 | app/models/test_track/notify_assignment_job.rb |