Class: Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Taskrouter::V1::WorkspaceContext::TaskContext
- Defined in:
- lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb,
lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb
Defined Under Namespace
Classes: ReservationContext, ReservationInstance, ReservationList, ReservationPage
Instance Method Summary collapse
-
#delete(if_match: :unset) ⇒ Boolean
Delete the TaskInstance.
-
#fetch ⇒ TaskInstance
Fetch the TaskInstance.
-
#initialize(version, workspace_sid, sid) ⇒ TaskContext
constructor
Initialize the TaskContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#reservations(sid = :unset) ⇒ ReservationList, ReservationContext
Access the reservations.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, virtual_start_time: :unset, if_match: :unset) ⇒ TaskInstance
Update the TaskInstance.
Constructor Details
#initialize(version, workspace_sid, sid) ⇒ TaskContext
Initialize the TaskContext
250 251 252 253 254 255 256 257 258 259 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 250 def initialize(version, workspace_sid, sid) super(version) # Path Solution @solution = { workspace_sid: workspace_sid, sid: sid, } @uri = "/Workspaces/#{@solution[:workspace_sid]}/Tasks/#{@solution[:sid]}" # Dependents @reservations = nil end |
Instance Method Details
#delete(if_match: :unset) ⇒ Boolean
Delete the TaskInstance
264 265 266 267 268 269 270 271 272 273 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 264 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 ⇒ TaskInstance
Fetch the TaskInstance
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 278 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) TaskInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
368 369 370 371 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 368 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.TaskContext #{context}>" end |
#reservations(sid = :unset) ⇒ ReservationList, ReservationContext
Access the reservations
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 343 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], task_sid: @solution[:sid], ) end @reservations end |
#to_s ⇒ Object
Provide a user friendly representation
361 362 363 364 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 361 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.TaskContext #{context}>" end |
#update(attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, virtual_start_time: :unset, if_match: :unset) ⇒ TaskInstance
Update the TaskInstance
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb', line 305 def update( attributes: :unset, assignment_status: :unset, reason: :unset, priority: :unset, task_channel: :unset, virtual_start_time: :unset, if_match: :unset ) data = Twilio::Values.of({ 'Attributes' => attributes, 'AssignmentStatus' => assignment_status, 'Reason' => reason, 'Priority' => priority, 'TaskChannel' => task_channel, 'VirtualStartTime' => Twilio.serialize_iso8601_datetime(virtual_start_time), }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) payload = @version.update('POST', @uri, data: data, headers: headers) TaskInstance.new( @version, payload, workspace_sid: @solution[:workspace_sid], sid: @solution[:sid], ) end |