Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskChannelContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, sid) ⇒ TaskChannelContext

Initialize the TaskChannelContext

Parameters:

  • version (Version)

    Version that contains the resource

  • workspace_sid (String)

    The SID of the Workspace with the Task Channel to update.

  • sid (String)

    The SID of the Task Channel resource to update.



232
233
234
235
236
237
238
239
240
241
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 232

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

#deleteBoolean

Delete the TaskChannelInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



245
246
247
248
249
250
251
252
253
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 245

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the TaskChannelInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 258

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],
      )
      .new(@version, taskChannel_instance, response.headers, response.status_code)
end

#fetchTaskChannelInstance

Fetch the TaskChannelInstance

Returns:



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 277

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_metadataTaskChannelInstance

Fetch the TaskChannelInstanceMetadata

Returns:



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 297

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],
    )
    .new(
        @version,
        task_channel_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



396
397
398
399
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 396

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Taskrouter.V1.TaskChannelContext #{context}>"
end

#to_sObject

Provide a user friendly representation



389
390
391
392
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 389

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

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long.

  • channel_optimized_routing (Boolean) (defaults to: :unset)

    Whether the TaskChannel should prioritize Workers that have been idle. If true, Workers that have been idle the longest are prioritized.

Returns:



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 325

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

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the Task Channel. It can be up to 64 characters long.

  • channel_optimized_routing (Boolean) (defaults to: :unset)

    Whether the TaskChannel should prioritize Workers that have been idle. If true, Workers that have been idle the longest are prioritized.

Returns:



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 355

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],
    )
    .new(
        @version,
        task_channel_instance,
        response.headers,
        response.status_code
    )
end