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 [addon](www.twilio.com/docs/taskrouter/marketplace) data for all installed addons.
-
#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.
-
#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.
-
#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, if_match: :unset) ⇒ TaskInstance
Update the TaskInstance.
-
#url ⇒ String
The absolute URL of the Task resource.
-
#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
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 376 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'], } # 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.
422 423 424 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 422 def account_sid @properties['account_sid'] end |
#addons ⇒ String
Returns An object that contains the [addon](www.twilio.com/docs/taskrouter/marketplace) data for all installed addons.
446 447 448 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 446 def addons @properties['addons'] end |
#age ⇒ String
Returns The number of seconds since the Task was created.
428 429 430 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 428 def age @properties['age'] end |
#assignment_status ⇒ Status
434 435 436 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 434 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.
440 441 442 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 440 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
413 414 415 416 417 418 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 413 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.
452 453 454 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 452 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.
458 459 460 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 458 def date_updated @properties['date_updated'] end |
#delete(if_match: :unset) ⇒ Boolean
Delete the TaskInstance
550 551 552 553 554 555 556 557 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 550 def delete( if_match: :unset ) context.delete( if_match: if_match, ) end |
#fetch ⇒ TaskInstance
Fetch the TaskInstance
562 563 564 565 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 562 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
611 612 613 614 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 611 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.TaskInstance #{values}>" end |
#links ⇒ Hash
Returns The URLs of related resources.
542 543 544 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 542 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.
470 471 472 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 470 def priority @properties['priority'] end |
#reason ⇒ String
Returns The reason the Task was canceled or completed, if applicable.
476 477 478 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 476 def reason @properties['reason'] end |
#reservations ⇒ reservations
Access the reservations
598 599 600 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 598 def reservations context.reservations end |
#sid ⇒ String
Returns The unique string that we created to identify the Task resource.
482 483 484 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 482 def sid @properties['sid'] end |
#task_channel_sid ⇒ String
Returns The SID of the TaskChannel.
500 501 502 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 500 def task_channel_sid @properties['task_channel_sid'] end |
#task_channel_unique_name ⇒ String
Returns The unique name of the TaskChannel.
506 507 508 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 506 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.
464 465 466 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 464 def task_queue_entered_date @properties['task_queue_entered_date'] end |
#task_queue_friendly_name ⇒ String
Returns The friendly name of the TaskQueue.
494 495 496 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 494 def task_queue_friendly_name @properties['task_queue_friendly_name'] end |
#task_queue_sid ⇒ String
Returns The SID of the TaskQueue.
488 489 490 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 488 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.
512 513 514 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 512 def timeout @properties['timeout'] end |
#to_s ⇒ Object
Provide a user friendly representation
604 605 606 607 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 604 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, if_match: :unset) ⇒ TaskInstance
Update the TaskInstance
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 576 def update( attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, if_match: :unset ) context.update( attributes: attributes, assignment_status: assignment_status, reason: reason, priority: priority, task_channel: task_channel, if_match: if_match, ) end |
#url ⇒ String
Returns The absolute URL of the Task resource.
536 537 538 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 536 def url @properties['url'] end |
#workflow_friendly_name ⇒ String
Returns The friendly name of the Workflow that is controlling the Task.
524 525 526 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 524 def workflow_friendly_name @properties['workflow_friendly_name'] end |
#workflow_sid ⇒ String
Returns The SID of the Workflow that is controlling the Task.
518 519 520 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 518 def workflow_sid @properties['workflow_sid'] end |
#workspace_sid ⇒ String
Returns The SID of the Workspace that contains the Task.
530 531 532 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 530 def workspace_sid @properties['workspace_sid'] end |