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 update.

  • sid (String)

    The SID of the TaskQueue resource to update.



220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 220

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
    @cumulative_statistics = nil
    @statistics = nil
    @real_time_statistics = nil
end

Instance Method Details

#cumulative_statisticsTaskQueueCumulativeStatisticsList, TaskQueueCumulativeStatisticsContext

Access the cumulative_statistics



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

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

#deleteBoolean

Delete the TaskQueueInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



235
236
237
238
239
240
241
242
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 235

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchTaskQueueInstance

Fetch the TaskQueueInstance

Returns:



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

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    TaskQueueInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



349
350
351
352
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 349

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



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

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

#statisticsTaskQueueStatisticsList, TaskQueueStatisticsContext

Access the statistics



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

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

#to_sObject

Provide a user friendly representation



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

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 (TaskOrder) (defaults to: :unset)

Returns:



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 273

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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    TaskQueueInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
end