class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkflowContext::WorkflowStatisticsContext

Public Class Methods

new(version, workspace_sid, workflow_sid) click to toggle source

Initialize the WorkflowStatisticsContext @param [Version] version Version that contains the resource @param [String] workspace_sid The SID of the Workspace with the Workflow to

fetch.

@param [String] workflow_sid Returns the list of Tasks that are being controlled

by the Workflow with the specified SID value.

@return [WorkflowStatisticsContext] WorkflowStatisticsContext

Calls superclass method Twilio::REST::InstanceContext::new
   # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
81 def initialize(version, workspace_sid, workflow_sid)
82   super(version)
83 
84   # Path Solution
85   @solution = {workspace_sid: workspace_sid, workflow_sid: workflow_sid, }
86   @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workflows/#{@solution[:workflow_sid]}/Statistics"
87 end

Public Instance Methods

fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset) click to toggle source

Fetch the WorkflowStatisticsInstance @param [String] minutes 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.

@param [Time] start_date Only calculate statistics from this date and time and

later, specified in {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.

@param [Time] end_date Only calculate statistics from this date and time and

earlier, specified in GMT as an {ISO
8601}[https://en.wikipedia.org/wiki/ISO_8601] date-time.

@param [String] task_channel Only calculate real-time statistics on this

TaskChannel. Can be the TaskChannel's SID or its `unique_name`, such as `voice`,
`sms`, or `default`.

@param [String] split_by_wait_time 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.

@return [WorkflowStatisticsInstance] Fetched WorkflowStatisticsInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
110 def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
111   params = Twilio::Values.of({
112       'Minutes' => minutes,
113       'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
114       'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
115       'TaskChannel' => task_channel,
116       'SplitByWaitTime' => split_by_wait_time,
117   })
118 
119   payload = @version.fetch('GET', @uri, params: params)
120 
121   WorkflowStatisticsInstance.new(
122       @version,
123       payload,
124       workspace_sid: @solution[:workspace_sid],
125       workflow_sid: @solution[:workflow_sid],
126   )
127 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
138 def inspect
139   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
140   "#<Twilio.Taskrouter.V1.WorkflowStatisticsContext #{context}>"
141 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
131 def to_s
132   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
133   "#<Twilio.Taskrouter.V1.WorkflowStatisticsContext #{context}>"
134 end