Class: Assistant::TechnicalSupport::CaseEventStream::Collector

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

Overview

Traverses one explicit case evidence graph, asks the event builder to
serialize every source, and returns an auditable coverage inventory alongside
the raw chronology.

Defined Under Namespace

Classes: Result

Constant Summary collapse

EventStream =
Assistant::TechnicalSupport::CaseEventStream
COLLECTIONS =
{
  activities: :activity_event,
  communications: :communication_event,
  calls: :call_event,
  uploads: :upload_event,
  orders: :order_event,
  quotes: :quote_event,
  rmas: :rma_event,
  room_configurations: :room_event
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(support_case, graph_class: EventStream::EvidenceGraph, redactor_class: EventStream::Redactor, builder_class: EventStream::EventBuilder) ⇒ Collector

Returns a new instance of Collector.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/services/assistant/technical_support/case_event_stream/collector.rb', line 23

def initialize(
  support_case,
  graph_class: EventStream::EvidenceGraph,
  redactor_class: EventStream::Redactor,
  builder_class: EventStream::EventBuilder
)
  @graph = graph_class.new(support_case)
  @coverage = EventStream::SOURCE_TYPES.index_with do
    { records_found: 0, records_included: 0, records_unavailable: 0, notes: [] }
  end
  @blockers = []
  @builder = builder_class.new(
    graph:,
    redactor: redactor_class.new(graph),
    on_record: method(:record_source),
    on_unavailable: method(:mark_unavailable)
  )
end

Instance Method Details

#callResult

Returns unsorted raw events plus availability audit.

Returns:

  • (Result)

    unsorted raw events plus availability audit



43
44
45
46
47
48
49
# File 'app/services/assistant/technical_support/case_event_stream/collector.rb', line 43

def call
  Result.new(
    raw_events: collect_events.freeze,
    coverage: coverage_result,
    blockers: blockers.uniq.freeze
  )
end