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

  • workspace_sid (String) (defaults to: nil)

    The SID of the Workspace that contains the TaskQueue.

  • task_queue_sid (String) (defaults to: nil)

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


133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 133

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'].to_i,
      'longest_task_waiting_sid' => payload['longest_task_waiting_sid'],
      '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'].to_i,
      'total_eligible_workers' => payload['total_eligible_workers'].to_i,
      'total_tasks' => payload['total_tasks'].to_i,
      'workspace_sid' => payload['workspace_sid'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'workspace_sid' => workspace_sid, 'task_queue_sid' => task_queue_sid, }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


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

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


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

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:


163
164
165
166
167
168
169
170
171
172
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 163

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:


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

def fetch(task_channel: :unset)
  context.fetch(task_channel: task_channel, )
end

#inspectObject

Provide a detailed, user friendly representation


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

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.

Returns:

  • (String)

    The relative age in the TaskQueue for the longest waiting Task.


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

def longest_relative_task_age_in_queue
  @properties['longest_relative_task_age_in_queue']
end

#longest_relative_task_sid_in_queueString

Returns The SID of the Task waiting in the TaskQueue the longest.

Returns:

  • (String)

    The SID of the Task waiting in the TaskQueue the longest.


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

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


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

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


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

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


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

def task_queue_sid
  @properties['task_queue_sid']
end

#tasks_by_priorityHash

Returns The number of Tasks by priority.

Returns:

  • (Hash)

    The number of Tasks by priority


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

def tasks_by_priority
  @properties['tasks_by_priority']
end

#tasks_by_statusHash

Returns The number of Tasks by their current status.

Returns:

  • (Hash)

    The number of Tasks by their current status


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

def tasks_by_status
  @properties['tasks_by_status']
end

#to_sObject

Provide a user friendly representation


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

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 available for Tasks in the TaskQueue.

Returns:

  • (String)

    The total number of Workers available for Tasks in the TaskQueue


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

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


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

def total_eligible_workers
  @properties['total_eligible_workers']
end

#total_tasksString

Returns The total number of Tasks.

Returns:

  • (String)

    The total number of Tasks


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

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


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

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


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

def workspace_sid
  @properties['workspace_sid']
end