Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskChannelContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskChannelContext
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the TaskChannelInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the TaskChannelInstanceMetadata.
-
#fetch ⇒ TaskChannelInstance
Fetch the TaskChannelInstance.
-
#fetch_with_metadata ⇒ TaskChannelInstance
Fetch the TaskChannelInstanceMetadata.
-
#initialize(version, workspace_sid, sid) ⇒ TaskChannelContext
constructor
Initialize the TaskChannelContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, channel_optimized_routing: :unset) ⇒ TaskChannelInstance
Update the TaskChannelInstance.
-
#update_with_metadata(friendly_name: :unset, channel_optimized_routing: :unset) ⇒ TaskChannelInstance
Update the TaskChannelInstanceMetadata.
Constructor Details
#initialize(version, workspace_sid, sid) ⇒ TaskChannelContext
Initialize the TaskChannelContext
240 241 242 243 244 245 246 247 248 249 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 240 def initialize(version, workspace_sid, sid) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, sid: sid, } @uri = "/Workspaces/#{@solution[:workspace_sid]}/TaskChannels/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the TaskChannelInstance
253 254 255 256 257 258 259 260 261 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 253 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the TaskChannelInstanceMetadata
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 266 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) taskChannel_instance = TaskChannelInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) TaskChannelInstanceMetadata.new(@version, taskChannel_instance, response.headers, response.status_code) end |
#fetch ⇒ TaskChannelInstance
Fetch the TaskChannelInstance
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 285 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) TaskChannelInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ TaskChannelInstance
Fetch the TaskChannelInstanceMetadata
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 305 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) task_channel_instance = TaskChannelInstance.new( @version, response.body, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) TaskChannelInstanceMetadata.new( @version, task_channel_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
404 405 406 407 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 404 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.TaskChannelContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
397 398 399 400 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 397 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.TaskChannelContext #{context}>" end |
#update(friendly_name: :unset, channel_optimized_routing: :unset) ⇒ TaskChannelInstance
Update the TaskChannelInstance
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 333 def update( friendly_name: :unset, channel_optimized_routing: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ChannelOptimizedRouting' => channel_optimized_routing, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) TaskChannelInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) end |
#update_with_metadata(friendly_name: :unset, channel_optimized_routing: :unset) ⇒ TaskChannelInstance
Update the TaskChannelInstanceMetadata
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 363 def ( friendly_name: :unset, channel_optimized_routing: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ChannelOptimizedRouting' => channel_optimized_routing, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) task_channel_instance = TaskChannelInstance.new( @version, response.body, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) TaskChannelInstanceMetadata.new( @version, task_channel_instance, response.headers, response.status_code ) end |