Class: Report::MissedCalls::MissedCallsCommand

Inherits:
BaseCommand
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#result_type_filterObject (readonly)



9
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 9

validates :result_type_filter, inclusion: { in: %w[both completed not_completed] }

Instance Method Details

#executeObject



11
12
13
14
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 11

def execute
  return unless valid?
  @result = Report::MissedCalls::MissedCalls.result_report(attributes)
end

#success?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 20

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

#unfiltered_dataObject



16
17
18
# File 'app/services/report/missed_calls/missed_calls_command.rb', line 16

def unfiltered_data
  Report::MissedCalls::MissedCalls.result_report(attributes.merge(result_type_filter: 'both')).data
end