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 the WorkerChannelInstance.
-
#fetch_with_metadata ⇒ WorkerChannelInstance
Fetch the WorkerChannelInstanceMetadata.
-
#initialize(version, workspace_sid, worker_sid, sid) ⇒ WorkerChannelContext
constructor
Initialize the WorkerChannelContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstance.
-
#update_with_metadata(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstanceMetadata.
Constructor Details
#initialize(version, workspace_sid, worker_sid, sid) ⇒ WorkerChannelContext
Initialize the WorkerChannelContext
172 173 174 175 176 177 178 179 180 181 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 172 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 the WorkerChannelInstance
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 185 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WorkerChannelInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ WorkerChannelInstance
Fetch the WorkerChannelInstanceMetadata
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 206 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) worker_channel_instance = WorkerChannelInstance.new( @version, response.body, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid], sid: @solution[:sid], ) WorkerChannelInstanceMetadata.new( @version, worker_channel_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
308 309 310 311 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 308 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkerChannelContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
301 302 303 304 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 301 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
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 235 def update( capacity: :unset, available: :unset ) data = Twilio::Values.of({ 'Capacity' => capacity, 'Available' => available, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) WorkerChannelInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid], sid: @solution[:sid], ) end |
#update_with_metadata(capacity: :unset, available: :unset) ⇒ WorkerChannelInstance
Update the WorkerChannelInstanceMetadata
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 266 def ( capacity: :unset, available: :unset ) data = Twilio::Values.of({ 'Capacity' => capacity, 'Available' => available, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) worker_channel_instance = WorkerChannelInstance.new( @version, response.body, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid], sid: @solution[:sid], ) WorkerChannelInstanceMetadata.new( @version, worker_channel_instance, response.headers, response.status_code ) end |