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.



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

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



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

def 
  @properties['account_sid']
end

#activity_statisticsHash

Returns The number of current Workers by Activity.

Returns:

  • (Hash)

    The number of current Workers by Activity



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

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:



167
168
169
170
171
172
173
174
175
176
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 167

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 a 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:



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

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

#inspectObject

Provide a detailed, user friendly representation



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

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.



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

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.



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

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



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

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



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

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



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

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



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

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



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

def tasks_by_status
  @properties['tasks_by_status']
end

#to_sObject

Provide a user friendly representation



274
275
276
277
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb', line 274

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



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

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



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

def total_eligible_workers
  @properties['total_eligible_workers']
end

#total_tasksString

Returns The total number of Tasks.

Returns:

  • (String)

    The total number of Tasks



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

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



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

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



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

def workspace_sid
  @properties['workspace_sid']
end