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

Public Class Methods

new(version, payload, workspace_sid: nil, workflow_sid: nil) click to toggle source

Initialize the WorkflowStatisticsInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] workspace_sid The SID of the Workspace that contains the

Workflow.

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

by the Workflow with the specified SID value.

@return [WorkflowStatisticsInstance] WorkflowStatisticsInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
154 def initialize(version, payload, workspace_sid: nil, workflow_sid: nil)
155   super(version)
156 
157   # Marshaled Properties
158   @properties = {
159       'account_sid' => payload['account_sid'],
160       'cumulative' => payload['cumulative'],
161       'realtime' => payload['realtime'],
162       'workflow_sid' => payload['workflow_sid'],
163       'workspace_sid' => payload['workspace_sid'],
164       'url' => payload['url'],
165   }
166 
167   # Context
168   @instance_context = nil
169   @params = {'workspace_sid' => workspace_sid, 'workflow_sid' => workflow_sid, }
170 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
189 def account_sid
190   @properties['account_sid']
191 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [WorkflowStatisticsContext] WorkflowStatisticsContext for this WorkflowStatisticsInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
176 def context
177   unless @instance_context
178     @instance_context = WorkflowStatisticsContext.new(
179         @version,
180         @params['workspace_sid'],
181         @params['workflow_sid'],
182     )
183   end
184   @instance_context
185 end
cumulative() click to toggle source

@return [Hash] An object that contains the cumulative statistics for the Workflow

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
195 def cumulative
196   @properties['cumulative']
197 end
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
244 def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
245   context.fetch(
246       minutes: minutes,
247       start_date: start_date,
248       end_date: end_date,
249       task_channel: task_channel,
250       split_by_wait_time: split_by_wait_time,
251   )
252 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
263 def inspect
264   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
265   "<Twilio.Taskrouter.V1.WorkflowStatisticsInstance #{values}>"
266 end
realtime() click to toggle source

@return [Hash] An object that contains the real-time statistics for the Workflow

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
201 def realtime
202   @properties['realtime']
203 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
256 def to_s
257   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
258   "<Twilio.Taskrouter.V1.WorkflowStatisticsInstance #{values}>"
259 end
url() click to toggle source

@return [String] The absolute URL of the Workflow statistics resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
219 def url
220   @properties['url']
221 end
workflow_sid() click to toggle source

@return [String] Returns the list of Tasks that are being controlled by the Workflow with the specified SID value

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
207 def workflow_sid
208   @properties['workflow_sid']
209 end
workspace_sid() click to toggle source

@return [String] The SID of the Workspace that contains the Workflow

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb
213 def workspace_sid
214   @properties['workspace_sid']
215 end