class Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelContext
Public Class Methods
Initialize the WorkerChannelContext
@param [Version] version Version
that contains the resource @param [String] workspace_sid The SID of the Workspace with the WorkerChannel to
fetch.
@param [String] worker_sid The SID of the Worker with the WorkerChannel to
fetch.
@param [String] sid The SID of the WorkerChannel to fetch. @return [WorkerChannelContext] WorkerChannelContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 163 def initialize(version, workspace_sid, worker_sid, sid) 164 super(version) 165 166 # Path Solution 167 @solution = {workspace_sid: workspace_sid, worker_sid: worker_sid, sid: sid, } 168 @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:worker_sid]}/Channels/#{@solution[:sid]}" 169 end
Public Instance Methods
Fetch the WorkerChannelInstance
@return [WorkerChannelInstance] Fetched WorkerChannelInstance
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 174 def fetch 175 payload = @version.fetch('GET', @uri) 176 177 WorkerChannelInstance.new( 178 @version, 179 payload, 180 workspace_sid: @solution[:workspace_sid], 181 worker_sid: @solution[:worker_sid], 182 sid: @solution[:sid], 183 ) 184 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 219 def inspect 220 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 221 "#<Twilio.Taskrouter.V1.WorkerChannelContext #{context}>" 222 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb 212 def to_s 213 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 214 "#<Twilio.Taskrouter.V1.WorkerChannelContext #{context}>" 215 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 196 def update(capacity: :unset, available: :unset) 197 data = Twilio::Values.of({'Capacity' => capacity, 'Available' => available, }) 198 199 payload = @version.update('POST', @uri, data: data) 200 201 WorkerChannelInstance.new( 202 @version, 203 payload, 204 workspace_sid: @solution[:workspace_sid], 205 worker_sid: @solution[:worker_sid], 206 sid: @solution[:sid], 207 ) 208 end