Class: SupportCaseClosedHandler

Inherits:
ApplicationJob show all
Includes:
RailsEventStore::AsyncHandler
Defined in:
app/subscribers/support_case_closed_handler.rb

Overview

Async handler for Events::SupportCaseClosed.

Sends a ReviewsIo review invitation to the customer after their support case
is closed. Running this asynchronously keeps the case-close transition fast
and isolates external HTTP failures from the main request cycle.

Instance Method Summary collapse

Instance Method Details

#perform(event) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'app/subscribers/support_case_closed_handler.rb', line 13

def perform(event)
  support_case = SupportCase.find_by(id: event.data[:support_case_id])
  return unless support_case

  Api::ReviewsIo::InvitationSender.new(support_case: support_case).process
rescue StandardError => e
  ErrorReporting.error(e)
  raise
end