Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerInstance
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the resource.
-
#activity_name ⇒ String
The friendly_name of the Worker’s current Activity.
-
#activity_sid ⇒ String
The SID of the Worker’s current Activity.
-
#attributes ⇒ String
The JSON string that describes the Worker.
-
#available ⇒ Boolean
Whether the Worker is available to perform tasks.
-
#context ⇒ WorkerContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#cumulative_statistics ⇒ cumulative_statistics
Access the cumulative_statistics.
-
#date_created ⇒ Time
The ISO 8601 date and time in GMT when the resource was created.
-
#date_status_changed ⇒ Time
The date and time in GMT of the last change to the Worker’s activity.
-
#date_updated ⇒ Time
The ISO 8601 date and time in GMT when the resource was last updated.
-
#delete ⇒ Boolean
Delete the WorkerInstance.
-
#fetch ⇒ WorkerInstance
Fetch the WorkerInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the resource.
-
#initialize(version, payload, workspace_sid: nil, sid: nil) ⇒ WorkerInstance
constructor
Initialize the WorkerInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ String
The URLs of related resources.
-
#real_time_statistics ⇒ real_time_statistics
Access the real_time_statistics.
-
#reservations ⇒ reservations
Access the reservations.
-
#sid ⇒ String
The unique string that identifies the resource.
-
#statistics ⇒ statistics
Access the statistics.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset) ⇒ WorkerInstance
Update the WorkerInstance.
-
#url ⇒ String
The absolute URL of the Worker resource.
-
#worker_channels ⇒ worker_channels
Access the worker_channels.
-
#workspace_sid ⇒ String
The SID of the Workspace that contains the Worker.
Constructor Details
#initialize(version, payload, workspace_sid: nil, sid: nil) ⇒ WorkerInstance
Initialize the WorkerInstance
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 424 def initialize(version, payload, workspace_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'activity_name' => payload['activity_name'], 'activity_sid' => payload['activity_sid'], 'attributes' => payload['attributes'], 'available' => payload['available'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_status_changed' => Twilio.deserialize_iso8601_datetime(payload['date_status_changed']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'friendly_name' => payload['friendly_name'], 'sid' => payload['sid'], 'workspace_sid' => payload['workspace_sid'], 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = {'workspace_sid' => workspace_sid, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
462 463 464 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 462 def account_sid @properties['account_sid'] end |
#activity_name ⇒ String
Returns The friendly_name of the Worker’s current Activity.
468 469 470 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 468 def activity_name @properties['activity_name'] end |
#activity_sid ⇒ String
Returns The SID of the Worker’s current Activity.
474 475 476 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 474 def activity_sid @properties['activity_sid'] end |
#attributes ⇒ String
Returns The JSON string that describes the Worker.
480 481 482 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 480 def attributes @properties['attributes'] end |
#available ⇒ Boolean
Returns Whether the Worker is available to perform tasks.
486 487 488 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 486 def available @properties['available'] end |
#context ⇒ WorkerContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
453 454 455 456 457 458 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 453 def context unless @instance_context @instance_context = WorkerContext.new(@version, @params['workspace_sid'], @params['sid'], ) end @instance_context end |
#cumulative_statistics ⇒ cumulative_statistics
Access the cumulative_statistics
586 587 588 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 586 def cumulative_statistics context.cumulative_statistics end |
#date_created ⇒ Time
Returns The ISO 8601 date and time in GMT when the resource was created.
492 493 494 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 492 def date_created @properties['date_created'] end |
#date_status_changed ⇒ Time
Returns The date and time in GMT of the last change to the Worker’s activity.
498 499 500 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 498 def date_status_changed @properties['date_status_changed'] end |
#date_updated ⇒ Time
Returns The ISO 8601 date and time in GMT when the resource was last updated.
504 505 506 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 504 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the WorkerInstance
572 573 574 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 572 def delete context.delete end |
#fetch ⇒ WorkerInstance
Fetch the WorkerInstance
541 542 543 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 541 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the resource.
510 511 512 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 510 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
620 621 622 623 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 620 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkerInstance #{values}>" end |
#links ⇒ String
Returns The URLs of related resources.
534 535 536 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 534 def links @properties['links'] end |
#real_time_statistics ⇒ real_time_statistics
Access the real_time_statistics
579 580 581 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 579 def real_time_statistics context.real_time_statistics end |
#reservations ⇒ reservations
Access the reservations
600 601 602 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 600 def reservations context.reservations end |
#sid ⇒ String
Returns The unique string that identifies the resource.
516 517 518 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 516 def sid @properties['sid'] end |
#statistics ⇒ statistics
Access the statistics
593 594 595 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 593 def statistics context.statistics end |
#to_s ⇒ Object
Provide a user friendly representation
613 614 615 616 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 613 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkerInstance #{values}>" end |
#update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset) ⇒ WorkerInstance
Update the WorkerInstance
560 561 562 563 564 565 566 567 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 560 def update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset) context.update( activity_sid: activity_sid, attributes: attributes, friendly_name: friendly_name, reject_pending_reservations: reject_pending_reservations, ) end |
#url ⇒ String
Returns The absolute URL of the Worker resource.
528 529 530 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 528 def url @properties['url'] end |
#worker_channels ⇒ worker_channels
Access the worker_channels
607 608 609 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 607 def worker_channels context.worker_channels end |
#workspace_sid ⇒ String
Returns The SID of the Workspace that contains the Worker.
522 523 524 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 522 def workspace_sid @properties['workspace_sid'] end |