Class: Report::GrossSalesReport::GrossSalesReportCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Report::GrossSalesReport::GrossSalesReportCommand
- Defined in:
- app/services/report/gross_sales_report/gross_sales_report_command.rb
Overview
Command pattern to encapsulate parameters necessary to run a presence report
Constant Summary collapse
- GROUPING_OPTIONS =
attribute :year, Integer, default: :default_year
[%w[year year], %w[quarter quarter], %w[month month], %w[week week]].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.company_options ⇒ Object
14 15 16 |
# File 'app/services/report/gross_sales_report/gross_sales_report_command.rb', line 14 def self. @company_options ||= Company.sales_companies.pluck(:name, :country_iso3) end |
.default_company_ids ⇒ Object
38 39 40 |
# File 'app/services/report/gross_sales_report/gross_sales_report_command.rb', line 38 def self.default_company_ids @default_company_ids ||= Company.sales_companies.ids end |
Instance Method Details
#execute ⇒ Object
22 23 24 25 26 |
# File 'app/services/report/gross_sales_report/gross_sales_report_command.rb', line 22 def execute return unless valid? @result = Report::GrossSalesReport::GrossSalesReport.total_report(attributes) end |
#success? ⇒ Boolean
28 29 30 |
# File 'app/services/report/gross_sales_report/gross_sales_report_command.rb', line 28 def success? valid? && @result.success? end |