class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerInstance

Public Class Methods

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

Initialize the WorkerInstance @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 Worker. @param [String] sid The SID of the Worker resource to fetch. @return [WorkerInstance] WorkerInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
421 def initialize(version, payload, workspace_sid: nil, sid: nil)
422   super(version)
423 
424   # Marshaled Properties
425   @properties = {
426       'account_sid' => payload['account_sid'],
427       'activity_name' => payload['activity_name'],
428       'activity_sid' => payload['activity_sid'],
429       'attributes' => payload['attributes'],
430       'available' => payload['available'],
431       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
432       'date_status_changed' => Twilio.deserialize_iso8601_datetime(payload['date_status_changed']),
433       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
434       'friendly_name' => payload['friendly_name'],
435       'sid' => payload['sid'],
436       'workspace_sid' => payload['workspace_sid'],
437       'url' => payload['url'],
438       'links' => payload['links'],
439   }
440 
441   # Context
442   @instance_context = nil
443   @params = {'workspace_sid' => workspace_sid, 'sid' => sid || @properties['sid'], }
444 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/worker.rb
459 def account_sid
460   @properties['account_sid']
461 end
activity_name() click to toggle source

@return [String] The friendly_name of the Worker's current Activity

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
465 def activity_name
466   @properties['activity_name']
467 end
activity_sid() click to toggle source

@return [String] The SID of the Worker's current Activity

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
471 def activity_sid
472   @properties['activity_sid']
473 end
attributes() click to toggle source

@return [String] The JSON string that describes the Worker

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

@return [Boolean] Whether the Worker is available to perform tasks

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
483 def available
484   @properties['available']
485 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 [WorkerContext] WorkerContext for this WorkerInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
450 def context
451   unless @instance_context
452     @instance_context = WorkerContext.new(@version, @params['workspace_sid'], @params['sid'], )
453   end
454   @instance_context
455 end
cumulative_statistics() click to toggle source

Access the cumulative_statistics @return [cumulative_statistics] cumulative_statistics

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
583 def cumulative_statistics
584   context.cumulative_statistics
585 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/worker.rb
489 def date_created
490   @properties['date_created']
491 end
date_status_changed() click to toggle source

@return [Time] The date and time in GMT of the last change to the Worker's activity

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
495 def date_status_changed
496   @properties['date_status_changed']
497 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/worker.rb
501 def date_updated
502   @properties['date_updated']
503 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
569 def delete
570   context.delete
571 end
fetch() click to toggle source

Fetch the WorkerInstance @return [WorkerInstance] Fetched WorkerInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
538 def fetch
539   context.fetch
540 end
friendly_name() click to toggle source

@return [String] The string that you assigned to describe the resource

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
507 def friendly_name
508   @properties['friendly_name']
509 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
617 def inspect
618   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
619   "<Twilio.Taskrouter.V1.WorkerInstance #{values}>"
620 end
real_time_statistics() click to toggle source

Access the real_time_statistics @return [real_time_statistics] real_time_statistics

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
576 def real_time_statistics
577   context.real_time_statistics
578 end
reservations() click to toggle source

Access the reservations @return [reservations] reservations

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
597 def reservations
598   context.reservations
599 end
sid() click to toggle source

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

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
513 def sid
514   @properties['sid']
515 end
statistics() click to toggle source

Access the statistics @return [statistics] statistics

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
590 def statistics
591   context.statistics
592 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
610 def to_s
611   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
612   "<Twilio.Taskrouter.V1.WorkerInstance #{values}>"
613 end
update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset) click to toggle source

Update the WorkerInstance @param [String] activity_sid The SID of a valid Activity that will describe the

Worker's initial state. See
{Activities}[https://www.twilio.com/docs/taskrouter/api/activity] for more
information.

@param [String] attributes The JSON string that describes the Worker. For

example: `{ "email": "Bob@example.com", "phone": "+5095551234" }`. This data is
passed to the `assignment_callback_url` when TaskRouter assigns a Task to the
Worker. Defaults to {}.

@param [String] friendly_name A descriptive string that you create to describe

the Worker. It can be up to 64 characters long.

@param [Boolean] reject_pending_reservations Whether to reject pending

reservations.

@return [WorkerInstance] Updated WorkerInstance

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
557 def update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset)
558   context.update(
559       activity_sid: activity_sid,
560       attributes: attributes,
561       friendly_name: friendly_name,
562       reject_pending_reservations: reject_pending_reservations,
563   )
564 end
url() click to toggle source

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

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
525 def url
526   @properties['url']
527 end
worker_channels() click to toggle source

Access the worker_channels @return [worker_channels] worker_channels

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
604 def worker_channels
605   context.worker_channels
606 end
workspace_sid() click to toggle source

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

    # File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb
519 def workspace_sid
520   @properties['workspace_sid']
521 end