Class: TestTrack::NotifyAssignmentJob
- Inherits:
-
Object
- Object
- TestTrack::NotifyAssignmentJob
- Defined in:
- app/models/test_track/notify_assignment_job.rb
Instance Attribute Summary collapse
-
#assignment ⇒ Object
readonly
Returns the value of attribute assignment.
-
#visitor_id ⇒ Object
readonly
Returns the value of attribute visitor_id.
Instance Method Summary collapse
-
#initialize(opts) ⇒ NotifyAssignmentJob
constructor
A new instance of NotifyAssignmentJob.
- #perform ⇒ Object
Constructor Details
#initialize(opts) ⇒ NotifyAssignmentJob
Returns a new instance of NotifyAssignmentJob.
4 5 6 7 8 9 10 11 12 |
# File 'app/models/test_track/notify_assignment_job.rb', line 4 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 |
Instance Attribute Details
#assignment ⇒ Object (readonly)
Returns the value of attribute assignment.
2 3 4 |
# File 'app/models/test_track/notify_assignment_job.rb', line 2 def assignment @assignment end |
#visitor_id ⇒ Object (readonly)
Returns the value of attribute visitor_id.
2 3 4 |
# File 'app/models/test_track/notify_assignment_job.rb', line 2 def visitor_id @visitor_id end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/test_track/notify_assignment_job.rb', line 14 def perform tracking_result = maybe_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 |