Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelContext
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb
Instance Method Summary collapse
-
#fetch ⇒ WorkerChannelInstance
Fetch a WorkerChannelInstance.
-
#initialize(version, workspace_sid, worker_sid, sid) ⇒ WorkerChannelContext
constructor
Initialize the WorkerChannelContext.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstance.
Constructor Details
#initialize(version, workspace_sid, worker_sid, sid) ⇒ WorkerChannelContext
Initialize the WorkerChannelContext
169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 169 def initialize(version, workspace_sid, worker_sid, sid) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, worker_sid: worker_sid, sid: sid, } @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:worker_sid]}/Channels/#{@solution[:sid]}" end |
Instance Method Details
#fetch ⇒ WorkerChannelInstance
Fetch a WorkerChannelInstance
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 184 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) WorkerChannelInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid], sid: @solution[:sid], ) end |
#to_s ⇒ Object
Provide a user friendly representation
230 231 232 233 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 230 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkerChannelContext #{context}>" end |
#update(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstance
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 207 def update(capacity: :unset, available: :unset) data = Twilio::Values.of({ 'Capacity' => capacity, 'Available' => available, }) payload = @version.update( 'POST', @uri, data: data, ) WorkerChannelInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid], sid: @solution[:sid], ) end |