Class: Twilio::REST::Studio::V1::FlowContext::ExecutionContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/studio/v1/flow/execution.rb,
lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step.rb,
lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb,
lib/twilio-ruby/rest/studio/v1/flow/execution/execution_step/execution_step_context.rb

Defined Under Namespace

Classes: ExecutionContextContext, ExecutionContextInstance, ExecutionContextInstanceMetadata, ExecutionContextList, ExecutionContextListResponse, ExecutionContextPage, ExecutionContextPageMetadata, ExecutionStepContext, ExecutionStepInstance, ExecutionStepInstanceMetadata, ExecutionStepList, ExecutionStepListResponse, ExecutionStepPage, ExecutionStepPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, flow_sid, sid) ⇒ ExecutionContext

Initialize the ExecutionContext



248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 248

def initialize(version, flow_sid, sid)
    super(version)
    

    # Path Solution
    @solution = { flow_sid: flow_sid, sid: sid,  }
    @uri = "/Flows/#{@solution[:flow_sid]}/Executions/#{@solution[:sid]}"

    # Dependents
    @execution_context = nil
    @steps = nil
end

Instance Method Details

#deleteBoolean

Delete the ExecutionInstance



263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 263

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

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

#delete_with_metadataBoolean

Delete the ExecutionInstanceMetadata



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 276

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      execution_instance = ExecutionInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, execution_instance, response.headers, response.status_code)
end

#execution_contextExecutionContextList, ExecutionContextContext

Access the execution_context



402
403
404
405
406
407
408
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 402

def execution_context
    ExecutionContextContext.new(
            @version,
            @solution[:flow_sid],
            @solution[:sid]
            )
end

#fetchExecutionInstance

Fetch the ExecutionInstance



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 295

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ExecutionInstance.new(
        @version,
        payload,
        flow_sid: @solution[:flow_sid],
        sid: @solution[:sid],
    )
end

#fetch_with_metadataExecutionInstance

Fetch the ExecutionInstanceMetadata



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 315

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    execution_instance = ExecutionInstance.new(
        @version,
        response.body,
        flow_sid: @solution[:flow_sid],
        sid: @solution[:sid],
    )
    .new(
        @version,
        execution_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



438
439
440
441
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 438

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

#steps(sid = :unset) ⇒ ExecutionStepList, ExecutionStepContext

Access the steps

Raises:

  • (ArgumentError)


413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 413

def steps(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return ExecutionStepContext.new(@version, @solution[:flow_sid], @solution[:sid],sid )
    end

    unless @steps
        @steps = ExecutionStepList.new(
            @version, flow_sid: @solution[:flow_sid], execution_sid: @solution[:sid], )
    end

 @steps
end

#to_sObject

Provide a user friendly representation



431
432
433
434
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 431

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

#update(status: nil) ⇒ ExecutionInstance

Update the ExecutionInstance



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 342

def update(
    status: nil
)

    data = Twilio::Values.of({
        'Status' => status,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ExecutionInstance.new(
        @version,
        payload,
        flow_sid: @solution[:flow_sid],
        sid: @solution[:sid],
    )
end

#update_with_metadata(status: nil) ⇒ ExecutionInstance

Update the ExecutionInstanceMetadata



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 369

def (
  status: nil
)

    data = Twilio::Values.of({
        'Status' => status,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    execution_instance = ExecutionInstance.new(
        @version,
        response.body,
        flow_sid: @solution[:flow_sid],
        sid: @solution[:sid],
    )
    .new(
        @version,
        execution_instance,
        response.headers,
        response.status_code
    )
end