Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowContext::WorkflowCumulativeStatisticsContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, workflow_sid) ⇒ WorkflowCumulativeStatisticsContext

Initialize the WorkflowCumulativeStatisticsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The workspace_sid

  • workflow_sid (String)

    The workflow_sid



75
76
77
78
79
80
81
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 75

def initialize(version, workspace_sid, workflow_sid)
  super(version)

  # Path Solution
  @solution = {workspace_sid: workspace_sid, workflow_sid: workflow_sid, }
  @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workflows/#{@solution[:workflow_sid]}/CumulativeStatistics"
end

Instance Method Details

#fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset, split_by_wait_time: :unset) ⇒ WorkflowCumulativeStatisticsInstance

Fetch a WorkflowCumulativeStatisticsInstance

Parameters:

  • end_date (Time) (defaults to: :unset)

    The end_date

  • minutes (String) (defaults to: :unset)

    The minutes

  • start_date (Time) (defaults to: :unset)

    The start_date

  • task_channel (String) (defaults to: :unset)

    The task_channel

  • split_by_wait_time (String) (defaults to: :unset)

    The split_by_wait_time

Returns:



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 91

def fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
  params = Twilio::Values.of({
      'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
      'Minutes' => minutes,
      'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
      'TaskChannel' => task_channel,
      'SplitByWaitTime' => split_by_wait_time,
  })

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  WorkflowCumulativeStatisticsInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      workflow_sid: @solution[:workflow_sid],
  )
end

#to_sObject

Provide a user friendly representation



116
117
118
119
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 116

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.WorkflowCumulativeStatisticsContext #{context}>"
end