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](www.twilio.com/docs/iam/api/account) that created the Worker 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 date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#date_status_changed ⇒ Time
The date and time in GMT of the last change to the Worker’s activity 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 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 ⇒ Hash
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 we created to identify the Worker 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, if_match: :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
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 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 725 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 || @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 Worker resource.
764 765 766 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 764 def account_sid @properties['account_sid'] end |
#activity_name ⇒ String
Returns The ‘friendly_name` of the Worker’s current Activity.
770 771 772 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 770 def activity_name @properties['activity_name'] end |
#activity_sid ⇒ String
Returns The SID of the Worker’s current Activity.
776 777 778 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 776 def activity_sid @properties['activity_sid'] end |
#attributes ⇒ String
Returns The JSON string that describes the Worker. For example: ‘{ "email": "Bob@example.com", "phone": "+5095551234" }`. Note If this property has been assigned a value, it will only be displayed in FETCH actions that return a single resource. Otherwise, this property will be null, even if it has a value. This data is passed to the `assignment_callback_url` when TaskRouter assigns a Task to the Worker.
782 783 784 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 782 def attributes @properties['attributes'] end |
#available ⇒ Boolean
Returns Whether the Worker is available to perform tasks.
788 789 790 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 788 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
755 756 757 758 759 760 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 755 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
910 911 912 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 910 def cumulative_statistics context.cumulative_statistics 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.
794 795 796 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 794 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 specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format. Used to calculate Workflow statistics.
800 801 802 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 800 def date_status_changed @properties['date_status_changed'] 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/worker.rb', line 806 def date_updated @properties['date_updated'] end |
#delete(if_match: :unset) ⇒ Boolean
Delete the WorkerInstance
844 845 846 847 848 849 850 851 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 844 def delete( if_match: :unset ) context.delete( if_match: if_match, ) end |
#fetch ⇒ WorkerInstance
Fetch the WorkerInstance
856 857 858 859 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 856 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the resource. Friendly names are case insensitive, and unique within the TaskRouter Workspace.
812 813 814 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 812 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
930 931 932 933 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 930 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkerInstance #{values}>" end |
#links ⇒ Hash
Returns The URLs of related resources.
836 837 838 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 836 def links @properties['links'] end |
#real_time_statistics ⇒ real_time_statistics
Access the real_time_statistics
896 897 898 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 896 def real_time_statistics context.real_time_statistics end |
#reservations ⇒ reservations
Access the reservations
889 890 891 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 889 def reservations context.reservations end |
#sid ⇒ String
Returns The unique string that we created to identify the Worker resource.
818 819 820 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 818 def sid @properties['sid'] end |
#statistics ⇒ statistics
Access the statistics
903 904 905 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 903 def statistics context.statistics end |
#to_s ⇒ Object
Provide a user friendly representation
923 924 925 926 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 923 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, if_match: :unset) ⇒ WorkerInstance
Update the WorkerInstance
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 869 def update( activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset, if_match: :unset ) context.update( activity_sid: activity_sid, attributes: attributes, friendly_name: friendly_name, reject_pending_reservations: reject_pending_reservations, if_match: if_match, ) end |
#url ⇒ String
Returns The absolute URL of the Worker resource.
830 831 832 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 830 def url @properties['url'] end |
#worker_channels ⇒ worker_channels
Access the worker_channels
917 918 919 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 917 def worker_channels context.worker_channels end |
#workspace_sid ⇒ String
Returns The SID of the Workspace that contains the Worker.
824 825 826 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 824 def workspace_sid @properties['workspace_sid'] end |