Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskQueueContext::TaskQueueRealTimeStatisticsInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, workspace_sid: nil, task_queue_sid: nil) ⇒ TaskQueueRealTimeStatisticsInstance

Initialize the TaskQueueRealTimeStatisticsInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this TaskQueueRealTimeStatistics resource.

  • sid (String) —

    The SID of the Call resource to fetch.



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 225

def initialize(version, payload , workspace_sid: nil, task_queue_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'activity_statistics' => payload['activity_statistics'],
        'longest_task_waiting_age' => payload['longest_task_waiting_age'] == nil ? payload['longest_task_waiting_age'] : payload['longest_task_waiting_age'].to_i,
        'longest_task_waiting_sid' => payload['longest_task_waiting_sid'],
        'longest_relative_task_age_in_queue' => payload['longest_relative_task_age_in_queue'] == nil ? payload['longest_relative_task_age_in_queue'] : payload['longest_relative_task_age_in_queue'].to_i,
        'longest_relative_task_sid_in_queue' => payload['longest_relative_task_sid_in_queue'],
        'task_queue_sid' => payload['task_queue_sid'],
        'tasks_by_priority' => payload['tasks_by_priority'],
        'tasks_by_status' => payload['tasks_by_status'],
        'total_available_workers' => payload['total_available_workers'] == nil ? payload['total_available_workers'] : payload['total_available_workers'].to_i,
        'total_eligible_workers' => payload['total_eligible_workers'] == nil ? payload['total_eligible_workers'] : payload['total_eligible_workers'].to_i,
        'total_tasks' => payload['total_tasks'] == nil ? payload['total_tasks'] : payload['total_tasks'].to_i,
        'workspace_sid' => payload['workspace_sid'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'workspace_sid' => workspace_sid  || @properties['workspace_sid']  ,'task_queue_sid' => task_queue_sid  || @properties['task_queue_sid']  , }
end

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that created the TaskQueue resource.

Returns:

  • (String) —

    The SID of the Account that created the TaskQueue resource.



265
266
267
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 265

def 
    @properties['account_sid']
end

#activity_statistics ⇒ Array<Hash>

Returns The number of current Workers by Activity.

Returns:

  • (Array<Hash>) —

    The number of current Workers by Activity.



271
272
273
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 271

def activity_statistics
    @properties['activity_statistics']
end

#context ⇒ TaskQueueRealTimeStatisticsContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 256

def context
    unless @instance_context
        @instance_context = TaskQueueRealTimeStatisticsContext.new(@version , @params['workspace_sid'], @params['task_queue_sid'])
    end
    @instance_context
end

#fetch(task_channel: :unset) ⇒ TaskQueueRealTimeStatisticsInstance

Fetch the TaskQueueRealTimeStatisticsInstance

Parameters:

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

    The TaskChannel for which to fetch statistics. Can be the TaskChannel's SID or its unique_name, such as voice, sms, or default.

Returns:



351
352
353
354
355
356
357
358
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 351

def fetch(
  task_channel: :unset
)

    context.fetch(
        task_channel: task_channel, 
    )
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



369
370
371
372
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 369

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsInstance #{values}>"
end

#longest_relative_task_age_in_queue ⇒ String

Returns The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue.

Returns:

  • (String) —

    The relative age in the TaskQueue for the longest waiting Task. Calculation is based on the time when the Task entered the TaskQueue.



289
290
291
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 289

def longest_relative_task_age_in_queue
    @properties['longest_relative_task_age_in_queue']
end

#longest_relative_task_sid_in_queue ⇒ String

Returns The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue.

Returns:

  • (String) —

    The Task SID of the Task waiting in the TaskQueue the longest. Calculation is based on the time when the Task entered the TaskQueue.



295
296
297
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 295

def longest_relative_task_sid_in_queue
    @properties['longest_relative_task_sid_in_queue']
end

#longest_task_waiting_age ⇒ String

Returns The age of the longest waiting Task.

Returns:

  • (String) —

    The age of the longest waiting Task.



277
278
279
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 277

def longest_task_waiting_age
    @properties['longest_task_waiting_age']
end

#longest_task_waiting_sid ⇒ String

Returns The SID of the longest waiting Task.

Returns:

  • (String) —

    The SID of the longest waiting Task.



283
284
285
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 283

def longest_task_waiting_sid
    @properties['longest_task_waiting_sid']
end

#task_queue_sid ⇒ String

Returns The SID of the TaskQueue from which these statistics were calculated.

Returns:

  • (String) —

    The SID of the TaskQueue from which these statistics were calculated.



301
302
303
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 301

def task_queue_sid
    @properties['task_queue_sid']
end

#tasks_by_priority ⇒ Hash

Returns The number of Tasks by priority. For example: {\"0\": \"10\", \"99\": \"5\"} shows 10 Tasks at priority 0 and 5 at priority 99.

Returns:

  • (Hash) —

    The number of Tasks by priority. For example: {\"0\": \"10\", \"99\": \"5\"} shows 10 Tasks at priority 0 and 5 at priority 99.



307
308
309
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 307

def tasks_by_priority
    @properties['tasks_by_priority']
end

#tasks_by_status ⇒ Hash

Returns The number of Tasks by their current status. For example: {\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}.

Returns:

  • (Hash) —

    The number of Tasks by their current status. For example: {\"pending\": \"1\", \"reserved\": \"3\", \"assigned\": \"2\", \"completed\": \"5\"}.



313
314
315
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 313

def tasks_by_status
    @properties['tasks_by_status']
end

#to_s ⇒ Object

Provide a user friendly representation



362
363
364
365
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 362

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Taskrouter.V1.TaskQueueRealTimeStatisticsInstance #{values}>"
end

#total_available_workers ⇒ String

Returns The total number of Workers in the TaskQueue with an available status. Workers with an available status may already have active interactions or may have none.

Returns:

  • (String) —

    The total number of Workers in the TaskQueue with an available status. Workers with an available status may already have active interactions or may have none.



319
320
321
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 319

def total_available_workers
    @properties['total_available_workers']
end

#total_eligible_workers ⇒ String

Returns The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state.

Returns:

  • (String) —

    The total number of Workers eligible for Tasks in the TaskQueue, independent of their Activity state.



325
326
327
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 325

def total_eligible_workers
    @properties['total_eligible_workers']
end

#total_tasks ⇒ String

Returns The total number of Tasks.

Returns:

  • (String) —

    The total number of Tasks.



331
332
333
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 331

def total_tasks
    @properties['total_tasks']
end

#url ⇒ String

Returns The absolute URL of the TaskQueue statistics resource.

Returns:

  • (String) —

    The absolute URL of the TaskQueue statistics resource.



343
344
345
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 343

def url
    @properties['url']
end

#workspace_sid ⇒ String

Returns The SID of the Workspace that contains the TaskQueue.

Returns:

  • (String) —

    The SID of the Workspace that contains the TaskQueue.



337
338
339
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 337

def workspace_sid
    @properties['workspace_sid']
end