Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext::WorkerChannelContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, workspace_sid, worker_sid, sid) ⇒ WorkerChannelContext

Initialize the WorkerChannelContext



141
142
143
144
145
146
147
148
149
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 141

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

#fetchWorkerChannelInstance

Fetch the WorkerChannelInstance



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 153

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

#inspectObject

Provide a detailed, user friendly representation



212
213
214
215
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 212

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

#to_sObject

Provide a user friendly representation



205
206
207
208
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 205

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



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb', line 176

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