Class: Twilio::REST::Taskrouter::V1::WorkspaceInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ WorkspaceInstance

Initialize the WorkspaceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid



469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 469

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'default_activity_name' => payload['default_activity_name'],
      'default_activity_sid' => payload['default_activity_sid'],
      'event_callback_url' => payload['event_callback_url'],
      'events_filter' => payload['events_filter'],
      'friendly_name' => payload['friendly_name'],
      'multi_task_enabled' => payload['multi_task_enabled'],
      'sid' => payload['sid'],
      'timeout_activity_name' => payload['timeout_activity_name'],
      'timeout_activity_sid' => payload['timeout_activity_sid'],
      'prioritize_queue_order' => payload['prioritize_queue_order'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns The ID of the account that owns this Workflow.

Returns:

  • (String)

    The ID of the account that owns this Workflow



509
510
511
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 509

def 
  @properties['account_sid']
end

#activitiesactivities

Access the activities

Returns:



651
652
653
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 651

def activities
  context.activities
end

#contextWorkspaceContext

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

Returns:



500
501
502
503
504
505
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 500

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

#cumulative_statisticscumulative_statistics

Access the cumulative_statistics

Returns:



707
708
709
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 707

def cumulative_statistics
  context.cumulative_statistics
end

#date_createdTime

Returns The time the Workspace was created, given as GMT in ISO 8601 format.

Returns:

  • (Time)

    The time the Workspace was created, given as GMT in ISO 8601 format.



515
516
517
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 515

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The time the Workspace was last updated, given as GMT in ISO 8601 format.

Returns:

  • (Time)

    The time the Workspace was last updated, given as GMT in ISO 8601 format.



521
522
523
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 521

def date_updated
  @properties['date_updated']
end

#default_activity_nameString

Returns The human readable name of the default activity.

Returns:

  • (String)

    The human readable name of the default activity.



527
528
529
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 527

def default_activity_name
  @properties['default_activity_name']
end

#default_activity_sidString

Returns The ID of the Activity that will be used when new Workers are created in this Workspace.

Returns:

  • (String)

    The ID of the Activity that will be used when new Workers are created in this Workspace.



533
534
535
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 533

def default_activity_sid
  @properties['default_activity_sid']
end

#deleteBoolean

Deletes the WorkspaceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



644
645
646
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 644

def delete
  context.delete
end

#event_callback_urlString

Returns If provided, the Workspace will publish events to this URL.

Returns:

  • (String)

    If provided, the Workspace will publish events to this URL.



539
540
541
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 539

def event_callback_url
  @properties['event_callback_url']
end

#eventsevents

Access the events

Returns:



658
659
660
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 658

def events
  context.events
end

#events_filterString

Returns Use this parameter to receive webhooks on EventCallbackUrl for specific events on a workspace.

Returns:

  • (String)

    Use this parameter to receive webhooks on EventCallbackUrl for specific events on a workspace.



545
546
547
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 545

def events_filter
  @properties['events_filter']
end

#fetchWorkspaceInstance

Fetch a WorkspaceInstance

Returns:



600
601
602
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 600

def fetch
  context.fetch
end

#friendly_nameString

Returns Filter by a workspace’s friendly name.

Returns:

  • (String)

    Filter by a workspace’s friendly name.



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



727
728
729
730
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 727

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

Returns The links.

Returns:

  • (String)

    The links



593
594
595
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 593

def links
  @properties['links']
end

#multi_task_enabledBoolean

Returns Multi tasking allows workers to handle multiple tasks simultaneously.

Returns:

  • (Boolean)

    Multi tasking allows workers to handle multiple tasks simultaneously.



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

def multi_task_enabled
  @properties['multi_task_enabled']
end

#prioritize_queue_orderworkspace.QueueOrder

Returns Use this parameter to configure whether to prioritize LIFO or FIFO when workers are receiving Tasks from combination of LIFO and FIFO TaskQueues.

Returns:

  • (workspace.QueueOrder)

    Use this parameter to configure whether to prioritize LIFO or FIFO when workers are receiving Tasks from combination of LIFO and FIFO TaskQueues.



581
582
583
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 581

def prioritize_queue_order
  @properties['prioritize_queue_order']
end

#real_time_statisticsreal_time_statistics

Access the real_time_statistics

Returns:



700
701
702
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 700

def real_time_statistics
  context.real_time_statistics
end

#sidString

Returns The unique ID of the Workspace.

Returns:

  • (String)

    The unique ID of the Workspace



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

def sid
  @properties['sid']
end

#statisticsstatistics

Access the statistics

Returns:



693
694
695
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 693

def statistics
  context.statistics
end

#task_channelstask_channels

Access the task_channels

Returns:



714
715
716
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 714

def task_channels
  context.task_channels
end

#task_queuestask_queues

Access the task_queues

Returns:



672
673
674
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 672

def task_queues
  context.task_queues
end

#taskstasks

Access the tasks

Returns:



665
666
667
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 665

def tasks
  context.tasks
end

#timeout_activity_nameString

Returns The human readable name of the timeout activity.

Returns:

  • (String)

    The human readable name of the timeout activity.



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

def timeout_activity_name
  @properties['timeout_activity_name']
end

#timeout_activity_sidString

Returns The ID of the Activity that will be assigned to a Worker when a Task reservation times out without a response.

Returns:

  • (String)

    The ID of the Activity that will be assigned to a Worker when a Task reservation times out without a response.



575
576
577
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 575

def timeout_activity_sid
  @properties['timeout_activity_sid']
end

#to_sObject

Provide a user friendly representation



720
721
722
723
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 720

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

#update(default_activity_sid: :unset, event_callback_url: :unset, events_filter: :unset, friendly_name: :unset, multi_task_enabled: :unset, timeout_activity_sid: :unset, prioritize_queue_order: :unset) ⇒ WorkspaceInstance

Update the WorkspaceInstance

Parameters:

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

    The ID of the Activity that will be used when new Workers are created in this Workspace.

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

    The Workspace will publish events to this URL. You can use this to gather data for reporting. See

    Events][/docs/taskrouter/api/events

    for more information.

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

    Use this parameter to receive webhooks on EventCallbackUrl for specific events on a workspace. For example if ‘EventsFilter=task.created,task.canceled,worker.activity.update’, then TaskRouter will webhook to EventCallbackUrl only when a task is created, canceled or a worker activity is updated.

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

    Human readable description of this workspace (for example “Sales Call Center” or “Customer Support Team”)

  • multi_task_enabled (Boolean) (defaults to: :unset)

    Enable or Disable Multitasking by passing either true or False with the POST request. Learn more by visiting [Multitasking].

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

    The ID of the Activity that will be assigned to a Worker when a Task reservation times out without a response.

  • prioritize_queue_order (workspace.QueueOrder) (defaults to: :unset)

    Use this parameter to configure whether to prioritize LIFO or FIFO when workers are receiving Tasks from combination of LIFO and FIFO TaskQueues. Default is FIFO. [Click here] to learn more about LIFO and the use of the parameter.

Returns:



629
630
631
632
633
634
635
636
637
638
639
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 629

def update(default_activity_sid: :unset, event_callback_url: :unset, events_filter: :unset, friendly_name: :unset, multi_task_enabled: :unset, timeout_activity_sid: :unset, prioritize_queue_order: :unset)
  context.update(
      default_activity_sid: default_activity_sid,
      event_callback_url: event_callback_url,
      events_filter: events_filter,
      friendly_name: friendly_name,
      multi_task_enabled: multi_task_enabled,
      timeout_activity_sid: timeout_activity_sid,
      prioritize_queue_order: prioritize_queue_order,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



587
588
589
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 587

def url
  @properties['url']
end

#workersworkers

Access the workers

Returns:



679
680
681
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 679

def workers
  context.workers
end

#workflowsworkflows

Access the workflows

Returns:



686
687
688
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 686

def workflows
  context.workflows
end