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.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 142

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_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the TaskQueue resource.

Returns:



181
182
183
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 181

def 
    @properties['account_sid']
end

#activity_statisticsArray<Hash>

Returns The number of current Workers by Activity.

Returns:

  • (Array<Hash>)

    The number of current Workers by Activity.



187
188
189
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 187

def activity_statistics
    @properties['activity_statistics']
end

#contextTaskQueueRealTimeStatisticsContext

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

Returns:



172
173
174
175
176
177
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 172

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:



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

def fetch(
    task_channel: :unset
)

    context.fetch(
        task_channel: task_channel, 
    )
end

#inspectObject

Provide a detailed, user friendly representation



285
286
287
288
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 285

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

#longest_relative_task_age_in_queueString

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.



205
206
207
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 205

def longest_relative_task_age_in_queue
    @properties['longest_relative_task_age_in_queue']
end

#longest_relative_task_sid_in_queueString

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.



211
212
213
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 211

def longest_relative_task_sid_in_queue
    @properties['longest_relative_task_sid_in_queue']
end

#longest_task_waiting_ageString

Returns The age of the longest waiting Task.

Returns:

  • (String)

    The age of the longest waiting Task.



193
194
195
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 193

def longest_task_waiting_age
    @properties['longest_task_waiting_age']
end

#longest_task_waiting_sidString

Returns The SID of the longest waiting Task.

Returns:

  • (String)

    The SID of the longest waiting Task.



199
200
201
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 199

def longest_task_waiting_sid
    @properties['longest_task_waiting_sid']
end

#task_queue_sidString

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.



217
218
219
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 217

def task_queue_sid
    @properties['task_queue_sid']
end

#tasks_by_priorityHash

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

Returns:

  • (Hash)

    The number of Tasks by priority. For example: ‘"10", "99": "5"` shows 10 Tasks at priority 0 and 5 at priority 99.



223
224
225
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 223

def tasks_by_priority
    @properties['tasks_by_priority']
end

#tasks_by_statusHash

Returns The number of Tasks by their current status. For example: ‘"1", "reserved": "3", "assigned": "2", "completed": "5"`.

Returns:

  • (Hash)

    The number of Tasks by their current status. For example: ‘"1", "reserved": "3", "assigned": "2", "completed": "5"`.



229
230
231
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 229

def tasks_by_status
    @properties['tasks_by_status']
end

#to_sObject

Provide a user friendly representation



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

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

#total_available_workersString

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.



235
236
237
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 235

def total_available_workers
    @properties['total_available_workers']
end

#total_eligible_workersString

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.



241
242
243
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 241

def total_eligible_workers
    @properties['total_eligible_workers']
end

#total_tasksString

Returns The total number of Tasks.

Returns:

  • (String)

    The total number of Tasks.



247
248
249
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 247

def total_tasks
    @properties['total_tasks']
end

#urlString

Returns The absolute URL of the TaskQueue statistics resource.

Returns:

  • (String)

    The absolute URL of the TaskQueue statistics resource.



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

def url
    @properties['url']
end

#workspace_sidString

Returns The SID of the Workspace that contains the TaskQueue.

Returns:

  • (String)

    The SID of the Workspace that contains the TaskQueue.



253
254
255
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 253

def workspace_sid
    @properties['workspace_sid']
end