class Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskInstance

Public Class Methods

new(version, payload, workspace_sid: nil, sid: nil) click to toggle source

Initialize the TaskInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] workspace_sid The SID of the Workspace that contains the Task. @param [String] sid The SID of the Task resource to fetch. @return [TaskInstance] TaskInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
420 def initialize(version, payload, workspace_sid: nil, sid: nil)
421   super(version)
422 
423   # Marshaled Properties
424   @properties = {
425       'account_sid' => payload['account_sid'],
426       'age' => payload['age'].to_i,
427       'assignment_status' => payload['assignment_status'],
428       'attributes' => payload['attributes'],
429       'addons' => payload['addons'],
430       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
431       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
432       'task_queue_entered_date' => Twilio.deserialize_iso8601_datetime(payload['task_queue_entered_date']),
433       'priority' => payload['priority'].to_i,
434       'reason' => payload['reason'],
435       'sid' => payload['sid'],
436       'task_queue_sid' => payload['task_queue_sid'],
437       'task_queue_friendly_name' => payload['task_queue_friendly_name'],
438       'task_channel_sid' => payload['task_channel_sid'],
439       'task_channel_unique_name' => payload['task_channel_unique_name'],
440       'timeout' => payload['timeout'].to_i,
441       'workflow_sid' => payload['workflow_sid'],
442       'workflow_friendly_name' => payload['workflow_friendly_name'],
443       'workspace_sid' => payload['workspace_sid'],
444       'url' => payload['url'],
445       'links' => payload['links'],
446   }
447 
448   # Context
449   @instance_context = nil
450   @params = {'workspace_sid' => workspace_sid, 'sid' => sid || @properties['sid'], }
451 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
466 def account_sid
467   @properties['account_sid']
468 end
addons() click to toggle source

@return [String] An object that contains the addon data for all installed addons

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
490 def addons
491   @properties['addons']
492 end
age() click to toggle source

@return [String] The number of seconds since the Task was created

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
472 def age
473   @properties['age']
474 end
assignment_status() click to toggle source

@return [task.Status] The current status of the Task's assignment

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
478 def assignment_status
479   @properties['assignment_status']
480 end
attributes() click to toggle source

@return [String] The JSON string with custom attributes of the work

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
484 def attributes
485   @properties['attributes']
486 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [TaskContext] TaskContext for this TaskInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
457 def context
458   unless @instance_context
459     @instance_context = TaskContext.new(@version, @params['workspace_sid'], @params['sid'], )
460   end
461   @instance_context
462 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
496 def date_created
497   @properties['date_created']
498 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
502 def date_updated
503   @properties['date_updated']
504 end
delete(if_match: :unset) click to toggle source

Delete the TaskInstance @param [String] if_match If provided, deletes this Task if (and only if) the

{ETag}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag] header of
the Task matches the provided value. This matches the semantics of (and is
implemented with) the HTTP {If-Match
header}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match].

@return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
639 def delete(if_match: :unset)
640   context.delete(if_match: if_match, )
641 end
fetch() click to toggle source

Fetch the TaskInstance @return [TaskInstance] Fetched TaskInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
593 def fetch
594   context.fetch
595 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
659 def inspect
660   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
661   "<Twilio.Taskrouter.V1.TaskInstance #{values}>"
662 end
priority() click to toggle source

@return [String] Retrieve the list of all Tasks in the Workspace with the specified priority

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
514 def priority
515   @properties['priority']
516 end
reason() click to toggle source

@return [String] The reason the Task was canceled or completed

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
520 def reason
521   @properties['reason']
522 end
reservations() click to toggle source

Access the reservations @return [reservations] reservations

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
646 def reservations
647   context.reservations
648 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
526 def sid
527   @properties['sid']
528 end
task_channel_sid() click to toggle source

@return [String] The SID of the TaskChannel

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
544 def task_channel_sid
545   @properties['task_channel_sid']
546 end
task_channel_unique_name() click to toggle source

@return [String] The unique name of the TaskChannel

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
550 def task_channel_unique_name
551   @properties['task_channel_unique_name']
552 end
task_queue_entered_date() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the Task entered the TaskQueue.

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
508 def task_queue_entered_date
509   @properties['task_queue_entered_date']
510 end
task_queue_friendly_name() click to toggle source

@return [String] The friendly name of the TaskQueue

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
538 def task_queue_friendly_name
539   @properties['task_queue_friendly_name']
540 end
task_queue_sid() click to toggle source

@return [String] The SID of the TaskQueue

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
532 def task_queue_sid
533   @properties['task_queue_sid']
534 end
timeout() click to toggle source

@return [String] The amount of time in seconds that the Task can live before being assigned

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
556 def timeout
557   @properties['timeout']
558 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
652 def to_s
653   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
654   "<Twilio.Taskrouter.V1.TaskInstance #{values}>"
655 end
update(attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, if_match: :unset) click to toggle source

Update the TaskInstance @param [String] attributes The JSON string that describes the custom attributes

of the task.

@param [task.Status] assignment_status The new status of the task. Can be:

`canceled`, to cancel a Task that is currently `pending` or `reserved`;
`wrapping`, to move the Task to wrapup state; or `completed`, to move a Task to
the completed state.

@param [String] reason The reason that the Task was canceled or completed. This

parameter is required only if the Task is canceled or completed. Setting this
value queues the task for deletion and logs the reason.

@param [String] priority The Task's new priority value. When supplied, the Task

takes on the specified priority unless it matches a Workflow Target with a
Priority set. Value can be 0 to 2^31^ (2,147,483,647).

@param [String] task_channel When MultiTasking is enabled, specify the

TaskChannel with the task to update. Can be the TaskChannel's SID or its
`unique_name`, such as `voice`, `sms`, or `default`.

@param [String] if_match If provided, applies this mutation if (and only if) the

{ETag}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag] header of
the Task matches the provided value. This matches the semantics of (and is
implemented with) the HTTP {If-Match
header}[https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match].

@return [TaskInstance] Updated TaskInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
620 def update(attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, if_match: :unset)
621   context.update(
622       attributes: attributes,
623       assignment_status: assignment_status,
624       reason: reason,
625       priority: priority,
626       task_channel: task_channel,
627       if_match: if_match,
628   )
629 end
url() click to toggle source

@return [String] The absolute URL of the Task resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
580 def url
581   @properties['url']
582 end
workflow_friendly_name() click to toggle source

@return [String] The friendly name of the Workflow that is controlling the Task

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
568 def workflow_friendly_name
569   @properties['workflow_friendly_name']
570 end
workflow_sid() click to toggle source

@return [String] The SID of the Workflow that is controlling the Task

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
562 def workflow_sid
563   @properties['workflow_sid']
564 end
workspace_sid() click to toggle source

@return [String] The SID of the Workspace that contains the Task

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb
574 def workspace_sid
575   @properties['workspace_sid']
576 end