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 SID of the Workspace with the resource to fetch.

  • workflow_sid (String)

    Returns the list of Tasks that are being controlled by the Workflow with the specified Sid value.


81
82
83
84
85
86
87
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 81

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 the WorkflowCumulativeStatisticsInstance

Parameters:

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

    Only include usage that occurred on or before this date, specified in GMT as an ISO 8601 date-time.

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

    Only calculate statistics since this many minutes in the past. The default 15 minutes. This is helpful for displaying statistics for the last 15 minutes, 240 minutes (4 hours), and 480 minutes (8 hours) to see trends.

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

    Only calculate statistics from this date and time and later, specified in ISO 8601 format.

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

    Only calculate cumulative statistics on this TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`, `sms`, or `default`.

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

    A comma separated list of values that describes the thresholds, in seconds, to calculate statistics on. For each threshold specified, the number of Tasks canceled and reservations accepted above and below the specified thresholds in seconds are computed. For example, `5,30` would show splits of Tasks that were canceled or accepted before and after 5 seconds and before and after 30 seconds. This can be used to show short abandoned Tasks or Tasks that failed to meet an SLA. TaskRouter will calculate statistics on up to 10,000 Tasks for any given threshold.

Returns:


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 111

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: params)

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

#inspectObject

Provide a detailed, user friendly representation


139
140
141
142
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 139

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

#to_sObject

Provide a user friendly representation


132
133
134
135
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb', line 132

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