Class: Report::OpportunitiesReport::OpportunitiesReportCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
app/services/report/opportunities_report/opportunities_report_command.rb

Overview

Command pattern to encapsulate parameters necessary to run a presence report

Constant Summary collapse

PERIOD_OPTIONS =

Available period options.

[["Daily", "daily"], ["3 months ago", "3 month"], ["6 months ago", "6 month"], ["9 months ago", "9 month"]].freeze
AMOUNT_OPTIONS =

Available amount options.

[[">= $2,000", 2000], [">= $5,000", 5000], [">= $10,000", 10_000]].freeze

Instance Method Summary collapse

Instance Method Details

#executeObject



16
17
18
19
20
# File 'app/services/report/opportunities_report/opportunities_report_command.rb', line 16

def execute
  return unless valid?

  @result = Report::OpportunitiesReport::OpportunitiesReport.result_report(attributes)
end

#success?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'app/services/report/opportunities_report/opportunities_report_command.rb', line 22

def success?
  valid? && @result.success?
end