Class: Report::OrdersOriginReport::OrdersReportCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Report::OrdersOriginReport::OrdersReportCommand
- Defined in:
- app/services/report/orders_origin_report/orders_report_command.rb
Overview
Command pattern to encapsulate parameters necessary to run a presence report
Constant Summary collapse
- GROUPING_OPTIONS =
Available grouping options.
[%w[quarter quarter], %w[month month], %w[week week]].freeze
Instance Attribute Summary collapse
-
#grouping ⇒ Object
readonly
Bucketing for the report rows; must be one of GROUPING_OPTIONS.
Instance Method Summary collapse
-
#execute ⇒ Object
Run the report with the given filters and store the result.
-
#success? ⇒ Boolean
Whether the command validated and ran successfully.
Instance Attribute Details
#grouping ⇒ Object (readonly)
Bucketing for the report rows; must be one of GROUPING_OPTIONS.
Validations:
- Inclusion ({ in: GROUPING_OPTIONS.map(&:first) })
13 |
# File 'app/services/report/orders_origin_report/orders_report_command.rb', line 13 validates :grouping, inclusion: { in: GROUPING_OPTIONS.map(&:first) } |
Instance Method Details
#execute ⇒ Object
Run the report with the given filters and store the result.
17 18 19 20 21 |
# File 'app/services/report/orders_origin_report/orders_report_command.rb', line 17 def execute return unless valid? @result = Report::OrdersOriginReport::OrdersReport.opportunity_report(attributes) end |
#success? ⇒ Boolean
Whether the command validated and ran successfully.
25 26 27 |
# File 'app/services/report/orders_origin_report/orders_report_command.rb', line 25 def success? valid? && @result.success? end |