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

  • account_sid (String)

    The SID of the Account that created this Workspace resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 776

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 SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Workspace resource.

Returns:



817
818
819
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 817

def 
    @properties['account_sid']
end

#activitiesactivities

Access the activities

Returns:



969
970
971
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 969

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:



808
809
810
811
812
813
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 808

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

#cumulative_statisticscumulative_statistics

Access the cumulative_statistics

Returns:



955
956
957
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 955

def cumulative_statistics
    context.cumulative_statistics
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



823
824
825
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 823

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



829
830
831
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 829

def date_updated
    @properties['date_updated']
end

#default_activity_nameString

Returns The name of the default activity.

Returns:

  • (String)

    The name of the default activity.



835
836
837
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 835

def default_activity_name
    @properties['default_activity_name']
end

#default_activity_sidString

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

Returns:

  • (String)

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



841
842
843
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 841

def default_activity_sid
    @properties['default_activity_sid']
end

#deleteBoolean

Delete the WorkspaceInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



908
909
910
911
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 908

def delete

    context.delete
end

#event_callback_urlString

Returns The URL we call when an event occurs. If provided, the Workspace will publish events to this URL, for example, to collect data for reporting. See [Workspace Events](www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio’s [Webhooks (HTTP callbacks) Connection Overrides](www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides).

Returns:



847
848
849
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 847

def event_callback_url
    @properties['event_callback_url']
end

#eventsevents

Access the events

Returns:



997
998
999
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 997

def events
    context.events
end

#events_filterString

Returns The list of Workspace events for which to call ‘event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated.

Returns:

  • (String)

    The list of Workspace events for which to call ‘event_callback_url`. For example, if `EventsFilter=task.created, task.canceled, worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated.



853
854
855
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 853

def events_filter
    @properties['events_filter']
end

#fetchWorkspaceInstance

Fetch the WorkspaceInstance

Returns:



916
917
918
919
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 916

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the Workspace resource. For example ‘Customer Support` or `2014 Election Campaign`.

Returns:

  • (String)

    The string that you assigned to describe the Workspace resource. For example ‘Customer Support` or `2014 Election Campaign`.



859
860
861
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 859

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



1031
1032
1033
1034
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 1031

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

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



901
902
903
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 901

def links
    @properties['links']
end

#multi_task_enabledBoolean

Returns Whether multi-tasking is enabled. The default is ‘true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](www.twilio.com/docs/taskrouter/multitasking).

Returns:

  • (Boolean)

    Whether multi-tasking is enabled. The default is ‘true`, which enables multi-tasking. Multi-tasking allows Workers to handle multiple Tasks simultaneously. When enabled (`true`), each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking each Worker would only receive a new reservation when the previous task is completed. Learn more at [Multitasking](www.twilio.com/docs/taskrouter/multitasking).



865
866
867
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 865

def multi_task_enabled
    @properties['multi_task_enabled']
end

#prioritize_queue_orderQueueOrder

Returns:

  • (QueueOrder)


889
890
891
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 889

def prioritize_queue_order
    @properties['prioritize_queue_order']
end

#real_time_statisticsreal_time_statistics

Access the real_time_statistics

Returns:



976
977
978
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 976

def real_time_statistics
    context.real_time_statistics
end

#sidString

Returns The unique string that we created to identify the Workspace resource.

Returns:

  • (String)

    The unique string that we created to identify the Workspace resource.



871
872
873
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 871

def sid
    @properties['sid']
end

#statisticsstatistics

Access the statistics

Returns:



1011
1012
1013
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 1011

def statistics
    context.statistics
end

#task_channelstask_channels

Access the task_channels

Returns:



1018
1019
1020
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 1018

def task_channels
    context.task_channels
end

#task_queuestask_queues

Access the task_queues

Returns:



962
963
964
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 962

def task_queues
    context.task_queues
end

#taskstasks

Access the tasks

Returns:



983
984
985
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 983

def tasks
    context.tasks
end

#timeout_activity_nameString

Returns The name of the timeout activity.

Returns:

  • (String)

    The name of the timeout activity.



877
878
879
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 877

def timeout_activity_name
    @properties['timeout_activity_name']
end

#timeout_activity_sidString

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

Returns:

  • (String)

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



883
884
885
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 883

def timeout_activity_sid
    @properties['timeout_activity_sid']
end

#to_sObject

Provide a user friendly representation



1024
1025
1026
1027
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 1024

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 SID of the Activity that will be used when new Workers are created in the Workspace.

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

    The URL we should call when an event occurs. See [Workspace Events](www.twilio.com/docs/taskrouter/api/event) for more information. This parameter supports Twilio’s [Webhooks (HTTP callbacks) Connection Overrides](www.twilio.com/docs/usage/webhooks/webhooks-connection-overrides).

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

    The list of Workspace events for which to call event_callback_url. For example if ‘EventsFilter=task.created,task.canceled,worker.activity.update`, then TaskRouter will call event_callback_url only when a task is created, canceled, or a Worker activity is updated.

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

    A descriptive string that you create to describe the Workspace resource. For example: ‘Sales Call Center` or `Customer Support Team`.

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

    Whether to enable multi-tasking. Can be: ‘true` to enable multi-tasking, or `false` to disable it. However, all workspaces should be maintained as multi-tasking. There is no default when omitting this parameter. A multi-tasking Workspace can’t be updated to single-tasking unless it is not a Flex Project and another (legacy) single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel reservations up to the per-channel maximums defined in the Workers section. In single-tasking mode (legacy mode), each Worker will only receive a new reservation when the previous task is completed. Learn more at [Multitasking](www.twilio.com/docs/taskrouter/multitasking).

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

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

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

Returns:



931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 931

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 absolute URL of the Workspace resource.

Returns:

  • (String)

    The absolute URL of the Workspace resource.



895
896
897
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 895

def url
    @properties['url']
end

#workersworkers

Access the workers

Returns:



1004
1005
1006
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 1004

def workers
    context.workers
end

#workflowsworkflows

Access the workflows

Returns:



990
991
992
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace.rb', line 990

def workflows
    context.workflows
end