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 unique ID of the Workspace that this TaskChannel belongs to.

  • sid (String)

    The unique ID for this TaskChannel.



180
181
182
183
184
185
186
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 180

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

Deletes the TaskChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



237
238
239
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 237

def delete
  @version.delete('delete', @uri)
end

#fetchTaskChannelInstance

Fetch a TaskChannelInstance

Returns:



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 191

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  TaskChannelInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



243
244
245
246
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 243

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)

    Toggle the FriendlyName for the TaskChannel

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

    A boolean that if true; mean that the channel will prioritize workers that have been idle

Returns:



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 214

def update(friendly_name: :unset, channel_optimized_routing: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'ChannelOptimizedRouting' => channel_optimized_routing,
  })

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  TaskChannelInstance.new(
      @version,
      payload,
      workspace_sid: @solution[:workspace_sid],
      sid: @solution[:sid],
  )
end