Class: TestTrack::AssignmentEventJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/test_track/assignment_event_job.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#assignmentObject (readonly)

Returns the value of attribute assignment.



3
4
5
# File 'app/jobs/test_track/assignment_event_job.rb', line 3

def assignment
  @assignment
end

#visitor_idObject (readonly)

Returns the value of attribute visitor_id.



3
4
5
# File 'app/jobs/test_track/assignment_event_job.rb', line 3

def visitor_id
  @visitor_id
end

Instance Method Details

#perform(visitor_id:, split_name:, variant:, context:) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'app/jobs/test_track/assignment_event_job.rb', line 5

def perform(visitor_id:, split_name:, variant:, context:)
  raise "visitor_id must be present" if visitor_id.blank?
  raise "split_name must be present" if visitor_id.blank?

  @visitor_id = visitor_id
  @assignment = build_assignment(visitor_id, split_name, variant, context)

  create_assignment_event!
end