Class: Assistant::TechnicalSupport::CaseReplaySourceValidator

Inherits:
Object
  • Object
show all
Defined in:
app/services/assistant/technical_support/case_replay_source_validator.rb

Overview

Confirms the replay source and Sunny account are eligible for an internal
Technical Support evaluation.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(support_case:, account:) ⇒ CaseReplaySourceValidator

Returns a new instance of CaseReplaySourceValidator.



12
13
14
15
# File 'app/services/assistant/technical_support/case_replay_source_validator.rb', line 12

def initialize(support_case:, account:)
  @support_case = support_case
  @account = 
end

Class Method Details

.call(support_case:, account:) ⇒ Object



7
8
9
# File 'app/services/assistant/technical_support/case_replay_source_validator.rb', line 7

def call(support_case:, account:)
  new(support_case:, account:).call
end

Instance Method Details

#callObject



17
18
19
20
21
22
23
24
# File 'app/services/assistant/technical_support/case_replay_source_validator.rb', line 17

def call
  return 'A source support case is required.' unless support_case
  return 'Only Technical Support cases can be replayed.' unless support_case.case_type == TechnicalSupportReplayCriteria::CASE_TYPE
  return 'Only closed cases can be replayed.' unless support_case.state == TechnicalSupportReplayCriteria::CLOSED_STATE
  return unless unauthorized_account?

  'An active employee with Technical Article read access is required to run Sunny.'
end