Class: Report::MissedCalls::MissedCallsCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- Report::MissedCalls::MissedCallsCommand
- Defined in:
- app/services/report/missed_calls/missed_calls_command.rb
Overview
Command pattern to encapsulate parameters necessary to run a presence report
Instance Attribute Summary collapse
-
#result_type_filter ⇒ Object
readonly
Filter on the call result type: both, completed, or not_completed.
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.
-
#unfiltered_data ⇒ Object
Unfiltered data.
Instance Attribute Details
#result_type_filter ⇒ Object (readonly)
Filter on the call result type: both, completed, or not_completed.
Validations:
- Inclusion ({ in: %w[both completed not_completed] })
10 |
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 10 validates :result_type_filter, inclusion: { in: %w[both completed not_completed] } |
Instance Method Details
#execute ⇒ Object
Run the report with the given filters and store the result.
14 15 16 17 18 |
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 14 def execute return unless valid? @result = Report::MissedCalls::MissedCalls.result_report(attributes) end |
#success? ⇒ Boolean
Whether the command validated and ran successfully.
28 29 30 |
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 28 def success? valid? && @result.success? end |
#unfiltered_data ⇒ Object
Unfiltered data.
22 23 24 |
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 22 def unfiltered_data Report::MissedCalls::MissedCalls.result_report(attributes.merge(result_type_filter: 'both')).data end |