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.



202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 202

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



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

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

#deleteBoolean

Delete the TaskQueueInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

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

#fetchTaskQueueInstance

Fetch the TaskQueueInstance

Returns:



225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 225

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



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

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



298
299
300
301
302
303
304
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 298

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

#statisticsTaskQueueStatisticsList, TaskQueueStatisticsContext

Access the statistics



287
288
289
290
291
292
293
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 287

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

#to_sObject

Provide a user friendly representation



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

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:



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 245

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