class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkspaceCumulativeStatisticsInstance
Public Class Methods
Initialize the WorkspaceCumulativeStatisticsInstance
@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. @return [WorkspaceCumulativeStatisticsInstance] WorkspaceCumulativeStatisticsInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 142 def initialize(version, payload, workspace_sid: nil) 143 super(version) 144 145 # Marshaled Properties 146 @properties = { 147 'account_sid' => payload['account_sid'], 148 'avg_task_acceptance_time' => payload['avg_task_acceptance_time'].to_i, 149 'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']), 150 'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']), 151 'reservations_created' => payload['reservations_created'].to_i, 152 'reservations_accepted' => payload['reservations_accepted'].to_i, 153 'reservations_rejected' => payload['reservations_rejected'].to_i, 154 'reservations_timed_out' => payload['reservations_timed_out'].to_i, 155 'reservations_canceled' => payload['reservations_canceled'].to_i, 156 'reservations_rescinded' => payload['reservations_rescinded'].to_i, 157 'split_by_wait_time' => payload['split_by_wait_time'], 158 'wait_duration_until_accepted' => payload['wait_duration_until_accepted'], 159 'wait_duration_until_canceled' => payload['wait_duration_until_canceled'], 160 'tasks_canceled' => payload['tasks_canceled'].to_i, 161 'tasks_completed' => payload['tasks_completed'].to_i, 162 'tasks_created' => payload['tasks_created'].to_i, 163 'tasks_deleted' => payload['tasks_deleted'].to_i, 164 'tasks_moved' => payload['tasks_moved'].to_i, 165 'tasks_timed_out_in_workflow' => payload['tasks_timed_out_in_workflow'].to_i, 166 'workspace_sid' => payload['workspace_sid'], 167 'url' => payload['url'], 168 } 169 170 # Context 171 @instance_context = nil 172 @params = {'workspace_sid' => workspace_sid, } 173 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 188 def account_sid 189 @properties['account_sid'] 190 end
@return [String] The average time in seconds between Task creation and acceptance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 194 def avg_task_acceptance_time 195 @properties['avg_task_acceptance_time'] 196 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [WorkspaceCumulativeStatisticsContext] WorkspaceCumulativeStatisticsContext
for this WorkspaceCumulativeStatisticsInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 179 def context 180 unless @instance_context 181 @instance_context = WorkspaceCumulativeStatisticsContext.new(@version, @params['workspace_sid'], ) 182 end 183 @instance_context 184 end
@return [Time] The end of the interval during which these statistics were calculated
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 206 def end_time 207 @properties['end_time'] 208 end
Fetch the WorkspaceCumulativeStatisticsInstance
@param [Time] end_date Only include usage that occurred on or before this date,
specified in GMT as an {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601] date-time.
@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 [String] task_channel Only calculate cumulative 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 [WorkspaceCumulativeStatisticsInstance] Fetched WorkspaceCumulativeStatisticsInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 333 def fetch(end_date: :unset, minutes: :unset, start_date: :unset, task_channel: :unset, split_by_wait_time: :unset) 334 context.fetch( 335 end_date: end_date, 336 minutes: minutes, 337 start_date: start_date, 338 task_channel: task_channel, 339 split_by_wait_time: split_by_wait_time, 340 ) 341 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 352 def inspect 353 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 354 "<Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsInstance #{values}>" 355 end
@return [String] The total number of Reservations accepted by Workers
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 218 def reservations_accepted 219 @properties['reservations_accepted'] 220 end
@return [String] The total number of Reservations that were canceled
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 236 def reservations_canceled 237 @properties['reservations_canceled'] 238 end
@return [String] The total number of Reservations that were created for Workers
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 212 def reservations_created 213 @properties['reservations_created'] 214 end
@return [String] The total number of Reservations that were rejected
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 224 def reservations_rejected 225 @properties['reservations_rejected'] 226 end
@return [String] The total number of Reservations that were rescinded
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 242 def reservations_rescinded 243 @properties['reservations_rescinded'] 244 end
@return [String] The total number of Reservations that were timed out
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 230 def reservations_timed_out 231 @properties['reservations_timed_out'] 232 end
@return [Hash] A list of objects that describe the Tasks canceled and reservations accepted above and below the specified thresholds
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 248 def split_by_wait_time 249 @properties['split_by_wait_time'] 250 end
@return [Time] The beginning of the interval during which these statistics were calculated
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 200 def start_time 201 @properties['start_time'] 202 end
@return [String] The total number of Tasks that were canceled
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 266 def tasks_canceled 267 @properties['tasks_canceled'] 268 end
@return [String] The total number of Tasks that were completed
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 272 def tasks_completed 273 @properties['tasks_completed'] 274 end
@return [String] The total number of Tasks created
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 278 def tasks_created 279 @properties['tasks_created'] 280 end
@return [String] The total number of Tasks that were deleted
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 284 def tasks_deleted 285 @properties['tasks_deleted'] 286 end
@return [String] The total number of Tasks that were moved from one queue to another
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 290 def tasks_moved 291 @properties['tasks_moved'] 292 end
@return [String] The total number of Tasks that were timed out of their Workflows
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 296 def tasks_timed_out_in_workflow 297 @properties['tasks_timed_out_in_workflow'] 298 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 345 def to_s 346 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 347 "<Twilio.Taskrouter.V1.WorkspaceCumulativeStatisticsInstance #{values}>" 348 end
@return [String] The absolute URL of the Workspace statistics resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 308 def url 309 @properties['url'] 310 end
@return [Hash] The wait duration statistics for Tasks that were accepted
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 254 def wait_duration_until_accepted 255 @properties['wait_duration_until_accepted'] 256 end
@return [Hash] The wait duration statistics for Tasks that were canceled
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 260 def wait_duration_until_canceled 261 @properties['wait_duration_until_canceled'] 262 end
@return [String] The SID of the Workspace
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb 302 def workspace_sid 303 @properties['workspace_sid'] 304 end