Class: OpportunityBriefing::ContextBuilder

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
app/services/opportunity_briefing/context_builder.rb

Overview

Builds the bounded CRM evidence snapshot supplied to the opportunity briefing
prompt. The model receives explicit records rather than discovering the deal
through open-ended SQL calls.

Defined Under Namespace

Classes: Result

Constant Summary collapse

ACTIVITY_LIMIT =
OpportunityBriefing::EngagementSnapshot::ACTIVITY_LIMIT
COMMUNICATION_LIMIT =
OpportunityBriefing::EngagementSnapshot::COMMUNICATION_LIMIT
QUOTE_LIMIT =
OpportunityBriefing::QuoteSnapshot::QUOTE_LIMIT
ORDER_LIMIT =
OpportunityBriefing::EngagementSnapshot::ORDER_LIMIT
CALL_LIMIT =
OpportunityBriefing::EngagementSnapshot::CALL_LIMIT
LINE_ITEM_LIMIT =
OpportunityBriefing::QuoteSnapshot::LINE_ITEM_LIMIT
REVISION_LINE_LIMIT =
OpportunityBriefing::QuoteSnapshot::REVISION_LINE_LIMIT
REVISION_CHANGE_LIMIT =
OpportunityBriefing::QuoteSnapshot::REVISION_CHANGE_LIMIT

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Instance Method Details

#callObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/services/opportunity_briefing/context_builder.rb', line 26

def call
  validate!

  Result.new(
    context: {
      briefing: briefing_data,
      opportunity: opportunity_snapshot.data,
      participants: engagement_snapshot.participants,
      quotes: quote_snapshot.quotes,
      focused_quote_line_items: quote_snapshot.focused_quote_line_items,
      focused_quote_revision_changes: quote_snapshot.focused_quote_revision_changes,
      activities: engagement_snapshot.activities,
      communications: engagement_snapshot.communications,
      call_records: engagement_snapshot.call_records,
      orders: engagement_snapshot.orders,
      outlet_purchases: outlet_purchase_snapshot.items,
      counts: counts
    }
  )
end