class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelInstance
Public Class Methods
Initialize the WorkerChannelInstance
@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
WorkerChannel.
@param [String] worker_sid
The SID of the Worker that contains the
WorkerChannel.
@param [String] sid The SID of the WorkerChannel to fetch. @return [WorkerChannelInstance] WorkerChannelInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 236 def initialize(version, payload, workspace_sid: nil, worker_sid: nil, sid: nil) 237 super(version) 238 239 # Marshaled Properties 240 @properties = { 241 'account_sid' => payload['account_sid'], 242 'assigned_tasks' => payload['assigned_tasks'].to_i, 243 'available' => payload['available'], 244 'available_capacity_percentage' => payload['available_capacity_percentage'].to_i, 245 'configured_capacity' => payload['configured_capacity'].to_i, 246 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 247 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 248 'sid' => payload['sid'], 249 'task_channel_sid' => payload['task_channel_sid'], 250 'task_channel_unique_name' => payload['task_channel_unique_name'], 251 'worker_sid' => payload['worker_sid'], 252 'workspace_sid' => payload['workspace_sid'], 253 'url' => payload['url'], 254 } 255 256 # Context 257 @instance_context = nil 258 @params = { 259 'workspace_sid' => workspace_sid, 260 'worker_sid' => worker_sid, 261 'sid' => sid || @properties['sid'], 262 } 263 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 283 def account_sid 284 @properties['account_sid'] 285 end
@return [String] The total number of Tasks assigned to Worker for the TaskChannel type
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 289 def assigned_tasks 290 @properties['assigned_tasks'] 291 end
@return [Boolean] Whether the Worker should receive Tasks of the TaskChannel type
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 295 def available 296 @properties['available'] 297 end
@return [String] The current available capacity between 0 to 100 for the TaskChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 301 def available_capacity_percentage 302 @properties['available_capacity_percentage'] 303 end
@return [String] The current configured capacity for the WorkerChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 307 def configured_capacity 308 @properties['configured_capacity'] 309 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [WorkerChannelContext] WorkerChannelContext
for this WorkerChannelInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 269 def context 270 unless @instance_context 271 @instance_context = WorkerChannelContext.new( 272 @version, 273 @params['workspace_sid'], 274 @params['worker_sid'], 275 @params['sid'], 276 ) 277 end 278 @instance_context 279 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 313 def date_created 314 @properties['date_created'] 315 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 319 def date_updated 320 @properties['date_updated'] 321 end
Fetch the WorkerChannelInstance
@return [WorkerChannelInstance] Fetched WorkerChannelInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 362 def fetch 363 context.fetch 364 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 389 def inspect 390 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 391 "<Twilio.Taskrouter.V1.WorkerChannelInstance #{values}>" 392 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 325 def sid 326 @properties['sid'] 327 end
@return [String] The SID of the TaskChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 331 def task_channel_sid 332 @properties['task_channel_sid'] 333 end
@return [String] The unique name of the TaskChannel, such as 'voice' or 'sms'
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 337 def task_channel_unique_name 338 @properties['task_channel_unique_name'] 339 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 382 def to_s 383 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 384 "<Twilio.Taskrouter.V1.WorkerChannelInstance #{values}>" 385 end
Update the WorkerChannelInstance
@param [String] capacity The total number of Tasks that the Worker should handle
for the TaskChannel type. TaskRouter creates reservations for Tasks of this TaskChannel type up to the specified capacity. If the capacity is 0, no new reservations will be created.
@param [Boolean] available Whether the WorkerChannel is available. Set to
`false` to prevent the Worker from receiving any new Tasks of this TaskChannel type.
@return [WorkerChannelInstance] Updated WorkerChannelInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 376 def update(capacity: :unset, available: :unset) 377 context.update(capacity: capacity, available: available, ) 378 end
@return [String] The absolute URL of the WorkerChannel resource
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 355 def url 356 @properties['url'] 357 end
@return [String] The SID of the Worker that contains the WorkerChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 343 def worker_sid 344 @properties['worker_sid'] 345 end
@return [String] The SID of the Workspace that contains the WorkerChannel
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 349 def workspace_sid 350 @properties['workspace_sid'] 351 end