Class: Assistant::TechnicalSupport::CaseEventStream::EventBuilder::ActivitySerializer

Inherits:
Base
  • Object
show all
Defined in:
app/services/assistant/technical_support/case_event_stream/event_builder/activity_serializer.rb

Constant Summary collapse

SOURCE_TYPE =
'Activity'
ADMINISTRATIVE_PATTERN =
/
  \A(?:
    Email:\s*Sent |
    Out\s+Call:\s*Ticket\s+Follow\s*up |
    \#\d+\s*-\s*Follow\s*Up |
    Follow\s+up\s+on\s+Support\s+Case |
    .+\s+added\s+to\s+Support\s+Case |
    .+Email\s+received.+automatically\s+processed
  )
/ix

Constants inherited from Base

Base::RawEvent

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Assistant::TechnicalSupport::CaseEventStream::EventBuilder::Base

Instance Method Details

#call(activity) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/services/assistant/technical_support/case_event_stream/event_builder/activity_serializer.rb', line 16

def call(activity)
  record_source(SOURCE_TYPE)
  description = clean_text(raw_attribute(activity, :description))
  result = result_for(activity)
  raw_event = event(
    activity,
    key_prefix: "activity-#{activity.id}",
    source_type: SOURCE_TYPE,
    occurred_at: occurred_at(activity),
    kind: kind_for(description),
    actor_role: actor_role_for(activity),
    status: result,
    text: activity_text(activity, description:, result:)
  )
  include_source(SOURCE_TYPE)
  raw_event
end