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

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

Defined Under Namespace

Classes: TaskQueueCumulativeStatisticsContext, TaskQueueCumulativeStatisticsInstance, TaskQueueCumulativeStatisticsList, TaskQueueCumulativeStatisticsPage, TaskQueueRealTimeStatisticsContext, TaskQueueRealTimeStatisticsInstance, TaskQueueRealTimeStatisticsList, TaskQueueRealTimeStatisticsPage, TaskQueueStatisticsContext, TaskQueueStatisticsInstance, TaskQueueStatisticsList, TaskQueueStatisticsPage

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, sid) ⇒ TaskQueueContext

Initialize the TaskQueueContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the TaskQueue to fetch.

  • sid (String)

    The SID of the TaskQueue resource to fetch.


237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 237

def initialize(version, workspace_sid, sid)
  super(version)

  # Path Solution
  @solution = {workspace_sid: workspace_sid, sid: sid, }
  @uri = "/Workspaces/#{@solution[:workspace_sid]}/TaskQueues/#{@solution[:sid]}"

  # Dependents
  @statistics = nil
  @real_time_statistics = nil
  @cumulative_statistics = nil
end

Instance Method Details

#cumulative_statisticsTaskQueueCumulativeStatisticsList, TaskQueueCumulativeStatisticsContext

Access the cumulative_statistics


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

def cumulative_statistics
  TaskQueueCumulativeStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
end

#deleteBoolean

Delete the TaskQueueInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


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

def delete
   @version.delete('DELETE', @uri)
end

#fetchTaskQueueInstance

Fetch the TaskQueueInstance

Returns:


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

def fetch
  payload = @version.fetch('GET', @uri)

  TaskQueueInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation


345
346
347
348
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 345

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.TaskQueueContext #{context}>"
end

#real_time_statisticsTaskQueueRealTimeStatisticsList, TaskQueueRealTimeStatisticsContext

Access the real_time_statistics


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

def real_time_statistics
  TaskQueueRealTimeStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
end

#statisticsTaskQueueStatisticsList, TaskQueueStatisticsContext

Access the statistics


316
317
318
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 316

def statistics
  TaskQueueStatisticsContext.new(@version, @solution[:workspace_sid], @solution[:sid], )
end

#to_sObject

Provide a user friendly representation


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

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Taskrouter.V1.TaskQueueContext #{context}>"
end

#update(friendly_name: :unset, target_workers: :unset, reservation_activity_sid: :unset, assignment_activity_sid: :unset, max_reserved_workers: :unset, task_order: :unset) ⇒ TaskQueueInstance

Update the TaskQueueInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the TaskQueue. For example `Support-Tier 1`, `Sales`, or `Escalation`.

  • target_workers (String) (defaults to: :unset)

    A string describing the Worker selection criteria for any Tasks that enter the TaskQueue. For example '“language” == “spanish”' If no TargetWorkers parameter is provided, Tasks will wait in the queue until they are either deleted or moved to another queue. Additional examples on how to describing Worker selection criteria below.

  • reservation_activity_sid (String) (defaults to: :unset)

    The SID of the Activity to assign Workers when a task is reserved for them.

  • assignment_activity_sid (String) (defaults to: :unset)

    The SID of the Activity to assign Workers when a task is assigned for them.

  • max_reserved_workers (String) (defaults to: :unset)

    The maximum number of Workers to create reservations for the assignment of a task while in the queue. Maximum of 50.

  • task_order (task_queue.TaskOrder) (defaults to: :unset)

    How Tasks will be assigned to Workers. Can be: `FIFO` or `LIFO` and the default is `FIFO`. Use `FIFO` to assign the oldest task first and `LIFO` to assign the most recent task first. For more information, see Queue Ordering.

Returns:


285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 285

def update(friendly_name: :unset, target_workers: :unset, reservation_activity_sid: :unset, assignment_activity_sid: :unset, max_reserved_workers: :unset, task_order: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'TargetWorkers' => target_workers,
      'ReservationActivitySid' => reservation_activity_sid,
      'AssignmentActivitySid' => assignment_activity_sid,
      'MaxReservedWorkers' => max_reserved_workers,
      'TaskOrder' => task_order,
  })

  payload = @version.update('POST', @uri, data: data)

  TaskQueueInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      sid: @solution[:sid],
  )
end