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.



161
162
163
164
165
166
167
168
169
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 161

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



173
174
175
176
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 173

def delete

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

#fetchTaskChannelInstance

Fetch the TaskChannelInstance

Returns:



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

def fetch

    payload = @version.fetch('GET', @uri)
    TaskChannelInstance.new(
        @version,
        payload,
        workspace_sid: @solution[:workspace_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



226
227
228
229
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 226

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

#to_sObject

Provide a user friendly representation



219
220
221
222
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 219

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:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb', line 197

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