Class: OpportunityBriefing::QuoteParentChange

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

Overview

Summarizes the price and elapsed-time change from a quote's parent revision.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Instance Method Details

#callObject



14
15
16
17
18
19
20
21
# File 'app/services/opportunity_briefing/quote_parent_change.rb', line 14

def call
  return Result.new unless quote.parent

  Result.new(data: {
    total: total_change,
    days_between_revisions: (quote.created_at.to_date - quote.parent.created_at.to_date).to_i
  }.compact)
end