Class: Assistant::TechnicalSupport::CaseEventStream::EvidenceGraph

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

Overview

Resolves the records that make up one Support Case's evidence graph. Only
explicit database relationships are followed; temporal or participant-based
guesses must never attach an unrelated call or document to a replay.

Defined Under Namespace

Classes: RecordReader

Instance Attribute Summary collapse

Delegated Instance Attributes collapse

Instance Method Summary collapse

Constructor Details

#initialize(support_case, record_reader: RecordReader.new) ⇒ EvidenceGraph

Returns a new instance of EvidenceGraph.



9
10
11
12
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 9

def initialize(support_case, record_reader: RecordReader.new)
  @support_case = support_case
  @record_reader = record_reader
end

Instance Attribute Details

#support_caseObject (readonly)

Returns the value of attribute support_case.



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

def support_case
  @support_case
end

Instance Method Details

#activitiesObject



20
21
22
23
24
25
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 20

def activities
  @activities ||= unique_records(
    array_for(support_case, :activities) +
      rmas.flat_map { |rma| array_for(rma, :activities) }
  )
end

#array_forObject

Alias for Record_reader#array_for

Returns:

  • (Object)

    Record_reader#array_for

See Also:



14
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 14

delegate :array_for, :first_present, :raw_attribute, :unique_records, :value_for, to: :record_reader

#callsObject



31
32
33
34
35
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 31

def calls
  @calls ||= unique_records(
    activities.filter_map { |activity| value_for(activity, :call_record) }
  )
end

#communicationsObject



27
28
29
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 27

def communications
  @communications ||= unique_records(communication_records)
end

#first_presentObject

Alias for Record_reader#first_present

Returns:

  • (Object)

    Record_reader#first_present

See Also:



14
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 14

delegate :array_for, :first_present, :raw_attribute, :unique_records, :value_for, to: :record_reader

#ordersObject



41
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 41

def orders = array_for(support_case, :orders)

#quotesObject



42
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 42

def quotes = array_for(support_case, :quotes)

#raw_attributeObject

Alias for Record_reader#raw_attribute

Returns:

  • (Object)

    Record_reader#raw_attribute

See Also:



14
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 14

delegate :array_for, :first_present, :raw_attribute, :unique_records, :value_for, to: :record_reader

#rmasObject



16
17
18
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 16

def rmas
  @rmas ||= unique_records(array_for(support_case, :rmas) + array_for(support_case, :order_rmas))
end

#room_configurationsObject



43
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 43

def room_configurations = array_for(support_case, :room_configurations)

#unique_recordsObject

Alias for Record_reader#unique_records

Returns:

  • (Object)

    Record_reader#unique_records

See Also:



14
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 14

delegate :array_for, :first_present, :raw_attribute, :unique_records, :value_for, to: :record_reader

#uploadsObject



37
38
39
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 37

def uploads
  @uploads ||= unique_records(upload_records)
end

#value_forObject

Alias for Record_reader#value_for

Returns:

  • (Object)

    Record_reader#value_for

See Also:



14
# File 'app/services/assistant/technical_support/case_event_stream/evidence_graph.rb', line 14

delegate :array_for, :first_present, :raw_attribute, :unique_records, :value_for, to: :record_reader