Class: Report::OpportunitiesVsLogistics::OpportunitiesVsLogisticsCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
app/services/report/opportunities_vs_logistics/opportunities_vs_logistics_command.rb

Overview

Service object: opportunities vs logistics command.

Constant Summary collapse

PRODUCT_LINE_OPTIONS =

Available product line options.

[["Floor Heating", 1], ["Snow Melting", 2], ["Roof & Gutter Deicing", 3], ["Pipe Freeze Protection", 4]].freeze
DISPLAY_OPTIONS =

Available display options.

[%w[Weekly week], %w[Monthly month], %w[Quarterly quarter]].freeze

Instance Method Summary collapse

Instance Method Details

#executeObject

Run the report with the given filters and store the result.

Returns:

  • (Object)


18
19
20
21
22
# File 'app/services/report/opportunities_vs_logistics/opportunities_vs_logistics_command.rb', line 18

def execute
  return unless valid?

  @result = Report::OpportunitiesVsLogistics::OpportunitiesVsLogistics.results(attributes)
end

#success?Boolean

Whether the command validated and ran successfully.

Returns:

  • (Boolean)


26
27
28
# File 'app/services/report/opportunities_vs_logistics/opportunities_vs_logistics_command.rb', line 26

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