Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskQueueInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, workspace_sid: nil, sid: nil) ⇒ TaskQueueInstance

Initialize the TaskQueueInstance

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.

  • sid (String) (defaults to: nil) —

    The SID of the TaskQueue resource to fetch.



366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 366

def initialize(version, payload, workspace_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'assignment_activity_sid' => payload['assignment_activity_sid'],
      'assignment_activity_name' => payload['assignment_activity_name'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'friendly_name' => payload['friendly_name'],
      'max_reserved_workers' => payload['max_reserved_workers'] == nil ? payload['max_reserved_workers'] : payload['max_reserved_workers'].to_i,
      'reservation_activity_sid' => payload['reservation_activity_sid'],
      'reservation_activity_name' => payload['reservation_activity_name'],
      'sid' => payload['sid'],
      'target_workers' => payload['target_workers'],
      'task_order' => payload['task_order'],
      'url' => payload['url'],
      'workspace_sid' => payload['workspace_sid'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'workspace_sid' => workspace_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that created the resource.

Returns:

  • (String) —

    The SID of the Account that created the resource



406
407
408
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 406

def 
  @properties['account_sid']
end

#assignment_activity_name ⇒ String

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

Returns:

  • (String) —

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



418
419
420
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 418

def assignment_activity_name
  @properties['assignment_activity_name']
end

#assignment_activity_sid ⇒ String

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

Returns:

  • (String) —

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



412
413
414
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 412

def assignment_activity_sid
  @properties['assignment_activity_sid']
end

#context ⇒ TaskQueueContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



397
398
399
400
401
402
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 397

def context
  unless @instance_context
    @instance_context = TaskQueueContext.new(@version, @params['workspace_sid'], @params['sid'], )
  end
  @instance_context
end

#cumulative_statistics ⇒ cumulative_statistics

Access the cumulative_statistics

Returns:



557
558
559
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 557

def cumulative_statistics
  context.cumulative_statistics
end

#date_created ⇒ Time

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time) —

    The RFC 2822 date and time in GMT when the resource was created



424
425
426
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 424

def date_created
  @properties['date_created']
end

#date_updated ⇒ Time

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time) —

    The RFC 2822 date and time in GMT when the resource was last updated



430
431
432
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 430

def date_updated
  @properties['date_updated']
end

#delete ⇒ Boolean

Delete the TaskQueueInstance

Returns:

  • (Boolean) —

    true if delete succeeds, false otherwise



536
537
538
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 536

def delete
  context.delete
end

#fetch ⇒ TaskQueueInstance

Fetch the TaskQueueInstance

Returns:



497
498
499
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 497

def fetch
  context.fetch
end

#friendly_name ⇒ String

Returns The string that you assigned to describe the resource.

Returns:

  • (String) —

    The string that you assigned to describe the resource



436
437
438
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 436

def friendly_name
  @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



570
571
572
573
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 570

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Taskrouter.V1.TaskQueueInstance #{values}>"
end

Returns The URLs of related resources.

Returns:

  • (String) —

    The URLs of related resources



490
491
492
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 490

def links
  @properties['links']
end

#max_reserved_workers ⇒ String

Returns The maximum number of Workers to reserve.

Returns:

  • (String) —

    The maximum number of Workers to reserve



442
443
444
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 442

def max_reserved_workers
  @properties['max_reserved_workers']
end

#real_time_statistics ⇒ real_time_statistics

Access the real_time_statistics

Returns:



550
551
552
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 550

def real_time_statistics
  context.real_time_statistics
end

#reservation_activity_name ⇒ String

Returns The name of the Activity to assign Workers once a task is reserved for them.

Returns:

  • (String) —

    The name of the Activity to assign Workers once a task is reserved for them



454
455
456
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 454

def reservation_activity_name
  @properties['reservation_activity_name']
end

#reservation_activity_sid ⇒ String

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

Returns:

  • (String) —

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



448
449
450
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 448

def reservation_activity_sid
  @properties['reservation_activity_sid']
end

#sid ⇒ String

Returns The unique string that identifies the resource.

Returns:

  • (String) —

    The unique string that identifies the resource



460
461
462
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 460

def sid
  @properties['sid']
end

#statistics ⇒ statistics

Access the statistics

Returns:



543
544
545
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 543

def statistics
  context.statistics
end

#target_workers ⇒ String

Returns A string describing the Worker selection criteria for any Tasks that enter the TaskQueue.

Returns:

  • (String) —

    A string describing the Worker selection criteria for any Tasks that enter the TaskQueue



466
467
468
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 466

def target_workers
  @properties['target_workers']
end

#task_order ⇒ task_queue.TaskOrder

Returns How Tasks will be assigned to Workers.

Returns:

  • (task_queue.TaskOrder) —

    How Tasks will be assigned to Workers



472
473
474
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 472

def task_order
  @properties['task_order']
end

#to_s ⇒ Object

Provide a user friendly representation



563
564
565
566
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 563

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Taskrouter.V1.TaskQueueInstance #{values}>"
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:



522
523
524
525
526
527
528
529
530
531
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 522

def update(friendly_name: :unset, target_workers: :unset, reservation_activity_sid: :unset, assignment_activity_sid: :unset, max_reserved_workers: :unset, task_order: :unset)
  context.update(
      friendly_name: friendly_name,
      target_workers: target_workers,
      reservation_activity_sid: reservation_activity_sid,
      assignment_activity_sid: assignment_activity_sid,
      max_reserved_workers: max_reserved_workers,
      task_order: task_order,
  )
end

#url ⇒ String

Returns The absolute URL of the TaskQueue resource.

Returns:

  • (String) —

    The absolute URL of the TaskQueue resource



478
479
480
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 478

def url
  @properties['url']
end

#workspace_sid ⇒ String

Returns The SID of the Workspace that contains the TaskQueue.

Returns:

  • (String) —

    The SID of the Workspace that contains the TaskQueue



484
485
486
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb', line 484

def workspace_sid
  @properties['workspace_sid']
end