Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelInstance
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.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.
-
#assigned_tasks ⇒ String
The total number of Tasks assigned to Worker for the TaskChannel type.
-
#available ⇒ Boolean
Whether the Worker should receive Tasks of the TaskChannel type.
-
#available_capacity_percentage ⇒ String
The current percentage of capacity the TaskChannel has available.
-
#configured_capacity ⇒ String
The current configured capacity for the WorkerChannel.
-
#context ⇒ WorkerChannelContext
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 [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_updated ⇒ Time
The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#fetch ⇒ WorkerChannelInstance
Fetch the WorkerChannelInstance.
-
#initialize(version, payload, workspace_sid: nil, worker_sid: nil, sid: nil) ⇒ WorkerChannelInstance
constructor
Initialize the WorkerChannelInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#sid ⇒ String
The unique string that we created to identify the WorkerChannel resource.
-
#task_channel_sid ⇒ String
The SID of the TaskChannel.
-
#task_channel_unique_name ⇒ String
The unique name of the TaskChannel, such as ‘voice` or `sms`.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstance.
-
#url ⇒ String
The absolute URL of the WorkerChannel resource.
-
#worker_sid ⇒ String
The SID of the Worker that contains the WorkerChannel.
-
#workspace_sid ⇒ String
The SID of the Workspace that contains the WorkerChannel.
Constructor Details
#initialize(version, payload, workspace_sid: nil, worker_sid: nil, sid: nil) ⇒ WorkerChannelInstance
Initialize the WorkerChannelInstance
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 256 def initialize(version, payload , workspace_sid: nil, worker_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'assigned_tasks' => payload['assigned_tasks'] == nil ? payload['assigned_tasks'] : payload['assigned_tasks'].to_i, 'available' => payload['available'], 'available_capacity_percentage' => payload['available_capacity_percentage'] == nil ? payload['available_capacity_percentage'] : payload['available_capacity_percentage'].to_i, 'configured_capacity' => payload['configured_capacity'] == nil ? payload['configured_capacity'] : payload['configured_capacity'].to_i, 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'sid' => payload['sid'], 'task_channel_sid' => payload['task_channel_sid'], 'task_channel_unique_name' => payload['task_channel_unique_name'], 'worker_sid' => payload['worker_sid'], 'workspace_sid' => payload['workspace_sid'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'workspace_sid' => workspace_sid || @properties['workspace_sid'] ,'worker_sid' => worker_sid || @properties['worker_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.
294 295 296 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 294 def account_sid @properties['account_sid'] end |
#assigned_tasks ⇒ String
Returns The total number of Tasks assigned to Worker for the TaskChannel type.
300 301 302 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 300 def assigned_tasks @properties['assigned_tasks'] end |
#available ⇒ Boolean
Returns Whether the Worker should receive Tasks of the TaskChannel type.
306 307 308 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 306 def available @properties['available'] end |
#available_capacity_percentage ⇒ String
Returns The current percentage of capacity the TaskChannel has available. Can be a number between ‘0` and `100`. A value of `0` indicates that TaskChannel has no capacity available and a value of `100` means the Worker is available to receive any Tasks of this TaskChannel type.
312 313 314 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 312 def available_capacity_percentage @properties['available_capacity_percentage'] end |
#configured_capacity ⇒ String
Returns The current configured capacity for the WorkerChannel. TaskRouter will not create any reservations after the assigned Tasks for the Worker reaches the value.
318 319 320 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 318 def configured_capacity @properties['configured_capacity'] end |
#context ⇒ WorkerChannelContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 285 def context unless @instance_context @instance_context = WorkerChannelContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
324 325 326 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 324 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 [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
330 331 332 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 330 def date_updated @properties['date_updated'] end |
#fetch ⇒ WorkerChannelInstance
Fetch the WorkerChannelInstance
373 374 375 376 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 373 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
403 404 405 406 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 403 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkerChannelInstance #{values}>" end |
#sid ⇒ String
Returns The unique string that we created to identify the WorkerChannel resource.
336 337 338 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 336 def sid @properties['sid'] end |
#task_channel_sid ⇒ String
Returns The SID of the TaskChannel.
342 343 344 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 342 def task_channel_sid @properties['task_channel_sid'] end |
#task_channel_unique_name ⇒ String
Returns The unique name of the TaskChannel, such as ‘voice` or `sms`.
348 349 350 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 348 def task_channel_unique_name @properties['task_channel_unique_name'] end |
#to_s ⇒ Object
Provide a user friendly representation
396 397 398 399 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 396 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.WorkerChannelInstance #{values}>" end |
#update(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstance
383 384 385 386 387 388 389 390 391 392 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 383 def update( capacity: :unset, available: :unset ) context.update( capacity: capacity, available: available, ) end |
#url ⇒ String
Returns The absolute URL of the WorkerChannel resource.
366 367 368 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 366 def url @properties['url'] end |
#worker_sid ⇒ String
Returns The SID of the Worker that contains the WorkerChannel.
354 355 356 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 354 def worker_sid @properties['worker_sid'] end |
#workspace_sid ⇒ String
Returns The SID of the Workspace that contains the WorkerChannel.
360 361 362 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 360 def workspace_sid @properties['workspace_sid'] end |