Class: Report::BookOfBusiness::BookOfBusinessCommand

Inherits:
Report::BaseCommand
  • Object
show all
Defined in:
app/services/report/book_of_business/book_of_business_command.rb

Overview

Command pattern to encapsulate parameters necessary to run a presence report

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.company_optionsObject

Company options.

Returns:

  • (Object)


15
16
17
# File 'app/services/report/book_of_business/book_of_business_command.rb', line 15

def self.company_options
  @company_options ||= Company.select_options_sales_companies
end

Instance Method Details

#executeObject

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

Returns:

  • (Object)


21
22
23
24
25
# File 'app/services/report/book_of_business/book_of_business_command.rb', line 21

def execute
  return unless valid?

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

#success?Boolean

Whether the command validated and ran successfully.

Returns:

  • (Boolean)


29
30
31
# File 'app/services/report/book_of_business/book_of_business_command.rb', line 29

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