Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskInstance
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Task resource.
-
#addons ⇒ String
An object that contains the [Add-on](www.twilio.com/docs/add-ons) data for all installed Add-ons.
-
#age ⇒ String
The number of seconds since the Task was created.
- #assignment_status ⇒ Status
-
#attributes ⇒ String
The JSON string with custom attributes of the work.
-
#context ⇒ TaskContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#date_updated ⇒ Time
The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#delete(if_match: :unset) ⇒ Boolean
Delete the TaskInstance.
-
#fetch ⇒ TaskInstance
Fetch the TaskInstance.
-
#ignore_capacity ⇒ Boolean
A boolean that indicates if the Task should respect a Worker’s capacity and availability during assignment.
-
#initialize(version, payload, workspace_sid: nil, sid: nil) ⇒ TaskInstance
constructor
Initialize the TaskInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ Hash
The URLs of related resources.
-
#priority ⇒ String
The current priority score of the Task as assigned to a Worker by the workflow.
-
#reason ⇒ String
The reason the Task was canceled or completed, if applicable.
-
#reservations ⇒ reservations
Access the reservations.
-
#routing_target ⇒ String
A SID of a Worker, Queue, or Workflow to route a Task to.
-
#sid ⇒ String
The unique string that we created to identify the Task resource.
-
#task_channel_sid ⇒ String
The SID of the TaskChannel.
-
#task_channel_unique_name ⇒ String
The unique name of the TaskChannel.
-
#task_queue_entered_date ⇒ Time
The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#task_queue_friendly_name ⇒ String
The friendly name of the TaskQueue.
-
#task_queue_sid ⇒ String
The SID of the TaskQueue.
-
#timeout ⇒ String
The amount of time in seconds that the Task can live before being assigned.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, virtual_start_time: :unset, if_match: :unset) ⇒ TaskInstance
Update the TaskInstance.
-
#url ⇒ String
The absolute URL of the Task resource.
-
#virtual_start_time ⇒ Time
The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#workflow_friendly_name ⇒ String
The friendly name of the Workflow that is controlling the Task.
-
#workflow_sid ⇒ String
The SID of the Workflow that is controlling the Task.
-
#workspace_sid ⇒ String
The SID of the Workspace that contains the Task.
Constructor Details
#initialize(version, payload, workspace_sid: nil, sid: nil) ⇒ TaskInstance
Initialize the TaskInstance
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 720 def initialize(version, payload , workspace_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'age' => payload['age'] == nil ? payload['age'] : payload['age'].to_i, 'assignment_status' => payload['assignment_status'], 'attributes' => payload['attributes'], 'addons' => payload['addons'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'task_queue_entered_date' => Twilio.deserialize_iso8601_datetime(payload['task_queue_entered_date']), 'priority' => payload['priority'] == nil ? payload['priority'] : payload['priority'].to_i, 'reason' => payload['reason'], 'sid' => payload['sid'], 'task_queue_sid' => payload['task_queue_sid'], 'task_queue_friendly_name' => payload['task_queue_friendly_name'], 'task_channel_sid' => payload['task_channel_sid'], 'task_channel_unique_name' => payload['task_channel_unique_name'], 'timeout' => payload['timeout'] == nil ? payload['timeout'] : payload['timeout'].to_i, 'workflow_sid' => payload['workflow_sid'], 'workflow_friendly_name' => payload['workflow_friendly_name'], 'workspace_sid' => payload['workspace_sid'], 'url' => payload['url'], 'links' => payload['links'], 'virtual_start_time' => Twilio.deserialize_iso8601_datetime(payload['virtual_start_time']), 'ignore_capacity' => payload['ignore_capacity'], 'routing_target' => payload['routing_target'], } # Context @instance_context = nil @params = { 'workspace_sid' => workspace_sid || @properties['workspace_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Task resource.
770 771 772 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 770 def account_sid @properties['account_sid'] end |
#addons ⇒ String
Returns An object that contains the [Add-on](www.twilio.com/docs/add-ons) data for all installed Add-ons.
794 795 796 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 794 def addons @properties['addons'] end |
#age ⇒ String
Returns The number of seconds since the Task was created.
776 777 778 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 776 def age @properties['age'] end |
#assignment_status ⇒ Status
782 783 784 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 782 def assignment_status @properties['assignment_status'] end |
#attributes ⇒ String
Returns The JSON string with custom attributes of the work. Note If this property has been assigned a value, it will only be displayed in FETCH action that returns a single resource. Otherwise, it will be null.
788 789 790 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 788 def attributes @properties['attributes'] end |
#context ⇒ TaskContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
761 762 763 764 765 766 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 761 def context unless @instance_context @instance_context = TaskContext.new(@version , @params['workspace_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
800 801 802 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 800 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
806 807 808 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 806 def date_updated @properties['date_updated'] end |
#delete(if_match: :unset) ⇒ Boolean
Delete the TaskInstance
916 917 918 919 920 921 922 923 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 916 def delete( if_match: :unset ) context.delete( if_match: if_match, ) end |
#fetch ⇒ TaskInstance
Fetch the TaskInstance
928 929 930 931 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 928 def fetch context.fetch end |
#ignore_capacity ⇒ Boolean
Returns A boolean that indicates if the Task should respect a Worker’s capacity and availability during assignment. This field can only be used when the RoutingTarget field is set to a Worker SID. By setting IgnoreCapacity to a value of true, 1, or yes, the Task will be routed to the Worker without respecting their capacity and availability. Any other value will enforce the Worker’s capacity and availability. The default value of IgnoreCapacity is true when the RoutingTarget is set to a Worker SID.
902 903 904 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 902 def ignore_capacity @properties['ignore_capacity'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
980 981 982 983 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 980 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.TaskInstance #{values}>" end |
#links ⇒ Hash
Returns The URLs of related resources.
890 891 892 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 890 def links @properties['links'] end |
#priority ⇒ String
Returns The current priority score of the Task as assigned to a Worker by the workflow. Tasks with higher priority values will be assigned before Tasks with lower values.
818 819 820 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 818 def priority @properties['priority'] end |
#reason ⇒ String
Returns The reason the Task was canceled or completed, if applicable.
824 825 826 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 824 def reason @properties['reason'] end |
#reservations ⇒ reservations
Access the reservations
967 968 969 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 967 def reservations context.reservations end |
#routing_target ⇒ String
Returns A SID of a Worker, Queue, or Workflow to route a Task to.
908 909 910 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 908 def routing_target @properties['routing_target'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Task resource.
830 831 832 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 830 def sid @properties['sid'] end |
#task_channel_sid ⇒ String
Returns The SID of the TaskChannel.
848 849 850 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 848 def task_channel_sid @properties['task_channel_sid'] end |
#task_channel_unique_name ⇒ String
Returns The unique name of the TaskChannel.
854 855 856 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 854 def task_channel_unique_name @properties['task_channel_unique_name'] end |
#task_queue_entered_date ⇒ Time
Returns The date and time in GMT when the Task entered the TaskQueue, specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
812 813 814 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 812 def task_queue_entered_date @properties['task_queue_entered_date'] end |
#task_queue_friendly_name ⇒ String
Returns The friendly name of the TaskQueue.
842 843 844 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 842 def task_queue_friendly_name @properties['task_queue_friendly_name'] end |
#task_queue_sid ⇒ String
Returns The SID of the TaskQueue.
836 837 838 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 836 def task_queue_sid @properties['task_queue_sid'] end |
#timeout ⇒ String
Returns The amount of time in seconds that the Task can live before being assigned.
860 861 862 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 860 def timeout @properties['timeout'] end |
#to_s ⇒ Object
Provide a user friendly representation
973 974 975 976 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 973 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.TaskInstance #{values}>" end |
#update(attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, virtual_start_time: :unset, if_match: :unset) ⇒ TaskInstance
Update the TaskInstance
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 943 def update( attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, virtual_start_time: :unset, if_match: :unset ) context.update( attributes: attributes, assignment_status: assignment_status, reason: reason, priority: priority, task_channel: task_channel, virtual_start_time: virtual_start_time, if_match: if_match, ) end |
#url ⇒ String
Returns The absolute URL of the Task resource.
884 885 886 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 884 def url @properties['url'] end |
#virtual_start_time ⇒ Time
Returns The date and time in GMT indicating the ordering for routing of the Task specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
896 897 898 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 896 def virtual_start_time @properties['virtual_start_time'] end |
#workflow_friendly_name ⇒ String
Returns The friendly name of the Workflow that is controlling the Task.
872 873 874 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 872 def workflow_friendly_name @properties['workflow_friendly_name'] end |
#workflow_sid ⇒ String
Returns The SID of the Workflow that is controlling the Task.
866 867 868 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 866 def workflow_sid @properties['workflow_sid'] end |
#workspace_sid ⇒ String
Returns The SID of the Workspace that contains the Task.
878 879 880 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 878 def workspace_sid @properties['workspace_sid'] end |