Class: Report::ProfileDiscount::ProfileDiscountCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
app/services/report/profile_discount/profile_discount_command.rb

Overview

Command pattern to encapsulate parameters necessary to run a presence report

Instance Method Summary collapse

Instance Method Details

#executeObject

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

Returns:

  • (Object)


8
9
10
11
12
# File 'app/services/report/profile_discount/profile_discount_command.rb', line 8

def execute
  return unless valid?

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

#success?Boolean

Whether the command validated and ran successfully.

Returns:

  • (Boolean)


16
17
18
# File 'app/services/report/profile_discount/profile_discount_command.rb', line 16

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