Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Taskrouter::V1::WorkspaceContext::WorkerContext
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_channel.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb
Defined Under Namespace
Classes: ReservationContext, ReservationInstance, ReservationList, ReservationPage, WorkerChannelContext, WorkerChannelInstance, WorkerChannelList, WorkerChannelPage, WorkerStatisticsContext, WorkerStatisticsInstance, WorkerStatisticsList, WorkerStatisticsPage, WorkersCumulativeStatisticsContext, WorkersCumulativeStatisticsInstance, WorkersCumulativeStatisticsList, WorkersCumulativeStatisticsPage, WorkersRealTimeStatisticsContext, WorkersRealTimeStatisticsInstance, WorkersRealTimeStatisticsList, WorkersRealTimeStatisticsPage
Instance Method Summary collapse
-
#cumulative_statistics ⇒ WorkersCumulativeStatisticsList, WorkersCumulativeStatisticsContext
Access the cumulative_statistics.
-
#delete(if_match: :unset) ⇒ Boolean
Delete the WorkerInstance.
-
#fetch ⇒ WorkerInstance
Fetch the WorkerInstance.
-
#initialize(version, workspace_sid, sid) ⇒ WorkerContext
constructor
Initialize the WorkerContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#real_time_statistics ⇒ WorkersRealTimeStatisticsList, WorkersRealTimeStatisticsContext
Access the real_time_statistics.
-
#reservations(sid = :unset) ⇒ ReservationList, ReservationContext
Access the reservations.
-
#statistics ⇒ WorkerStatisticsList, WorkerStatisticsContext
Access the statistics.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset, if_match: :unset) ⇒ WorkerInstance
Update the WorkerInstance.
-
#worker_channels(sid = :unset) ⇒ WorkerChannelList, WorkerChannelContext
Access the worker_channels.
Constructor Details
#initialize(version, workspace_sid, sid) ⇒ WorkerContext
Initialize the WorkerContext
226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 226 def initialize(version, workspace_sid, sid) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, sid: sid, } @uri = "/Workspaces/#{@solution[:workspace_sid]}/Workers/#{@solution[:sid]}" # Dependents @reservations = nil @real_time_statistics = nil @statistics = nil @cumulative_statistics = nil @worker_channels = nil end |
Instance Method Details
#cumulative_statistics ⇒ WorkersCumulativeStatisticsList, WorkersCumulativeStatisticsContext
Access the cumulative_statistics
358 359 360 361 362 363 364 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 358 def cumulative_statistics WorkersCumulativeStatisticsContext.new( @version, @solution[:workspace_sid], @solution[:sid] ) end |
#delete(if_match: :unset) ⇒ Boolean
Delete the WorkerInstance
244 245 246 247 248 249 250 251 252 253 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 244 def delete( if_match: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ WorkerInstance
Fetch the WorkerInstance
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 258 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) WorkerInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
394 395 396 397 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 394 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkerContext #{context}>" end |
#real_time_statistics ⇒ WorkersRealTimeStatisticsList, WorkersRealTimeStatisticsContext
Access the real_time_statistics
336 337 338 339 340 341 342 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 336 def real_time_statistics WorkersRealTimeStatisticsContext.new( @version, @solution[:workspace_sid], @solution[:sid] ) end |
#reservations(sid = :unset) ⇒ ReservationList, ReservationContext
Access the reservations
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 317 def reservations(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ReservationContext.new(@version, @solution[:workspace_sid], @solution[:sid],sid ) end unless @reservations @reservations = ReservationList.new( @version, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:sid], ) end @reservations end |
#statistics ⇒ WorkerStatisticsList, WorkerStatisticsContext
Access the statistics
347 348 349 350 351 352 353 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 347 def statistics WorkerStatisticsContext.new( @version, @solution[:workspace_sid], @solution[:sid] ) end |
#to_s ⇒ Object
Provide a user friendly representation
387 388 389 390 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 387 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.WorkerContext #{context}>" end |
#update(activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset, if_match: :unset) ⇒ WorkerInstance
Update the WorkerInstance
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 283 def update( activity_sid: :unset, attributes: :unset, friendly_name: :unset, reject_pending_reservations: :unset, if_match: :unset ) data = Twilio::Values.of({ 'ActivitySid' => activity_sid, 'Attributes' => attributes, 'FriendlyName' => friendly_name, 'RejectPendingReservations' => reject_pending_reservations, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) payload = @version.update('POST', @uri, data: data, headers: headers) WorkerInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) end |
#worker_channels(sid = :unset) ⇒ WorkerChannelList, WorkerChannelContext
Access the worker_channels
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb', line 369 def worker_channels(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return WorkerChannelContext.new(@version, @solution[:workspace_sid], @solution[:sid],sid ) end unless @worker_channels @worker_channels = WorkerChannelList.new( @version, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:sid], ) end @worker_channels end |