class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkspaceStatisticsContext
Public Class Methods
Initialize the WorkspaceStatisticsContext
@param [Version] version Version
that contains the resource @param [String] workspace_sid The SID of the Workspace to fetch. @return [WorkspaceStatisticsContext] WorkspaceStatisticsContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb 69 def initialize(version, workspace_sid) 70 super(version) 71 72 # Path Solution 73 @solution = {workspace_sid: workspace_sid, } 74 @uri = "/Workspaces/#{@solution[:workspace_sid]}/Statistics" 75 end
Public Instance Methods
Fetch the WorkspaceStatisticsInstance
@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 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 [WorkspaceStatisticsInstance] Fetched WorkspaceStatisticsInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb 98 def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset) 99 params = Twilio::Values.of({ 100 'Minutes' => minutes, 101 'StartDate' => Twilio.serialize_iso8601_datetime(start_date), 102 'EndDate' => Twilio.serialize_iso8601_datetime(end_date), 103 'TaskChannel' => task_channel, 104 'SplitByWaitTime' => split_by_wait_time, 105 }) 106 107 payload = @version.fetch('GET', @uri, params: params) 108 109 WorkspaceStatisticsInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], ) 110 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb 121 def inspect 122 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 123 "#<Twilio.Taskrouter.V1.WorkspaceStatisticsContext #{context}>" 124 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb 114 def to_s 115 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 116 "#<Twilio.Taskrouter.V1.WorkspaceStatisticsContext #{context}>" 117 end