Class: Twilio::REST::Studio::V2::FlowContext::ExecutionContext

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Defined Under Namespace

Classes: ExecutionContextContext, ExecutionContextInstance, ExecutionContextList, ExecutionContextPage, ExecutionStepContext, ExecutionStepInstance, ExecutionStepList, ExecutionStepPage

Instance Method Summary collapse

Constructor Details

#initialize(version, flow_sid, sid) ⇒ ExecutionContext

Initialize the ExecutionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • flow_sid (String)

    The SID of the Flow with the Execution resource to fetch

  • sid (String)

    The SID of the Execution resource to fetch.



213
214
215
216
217
218
219
220
221
222
223
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 213

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
  @steps = nil
  @execution_context = nil
end

Instance Method Details

#deleteBoolean

Delete the ExecutionInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



237
238
239
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 237

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

#execution_contextExecutionContextList, ExecutionContextContext

Access the execution_context



280
281
282
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 280

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

#fetchExecutionInstance

Fetch the ExecutionInstance

Returns:



228
229
230
231
232
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 228

def fetch
  payload = @version.fetch('GET', @uri)

  ExecutionInstance.new(@version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation



293
294
295
296
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 293

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

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

Access the steps

Returns:

Raises:

  • (ArgumentError)


258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 258

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



286
287
288
289
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 286

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

#update(status: nil) ⇒ ExecutionInstance

Update the ExecutionInstance

Parameters:

  • status (execution.Status) (defaults to: nil)

    The status of the Execution. Can only be ‘ended`.

Returns:



246
247
248
249
250
251
252
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 246

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

  payload = @version.update('POST', @uri, data: data)

  ExecutionInstance.new(@version, payload, flow_sid: @solution[:flow_sid], sid: @solution[:sid], )
end