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, 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 unique SID identifier of the Flow.

  • sid (String)

    The unique SID identifier of the Execution.



208
209
210
211
212
213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 208

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

Deletes the ExecutionInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

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

#execution_contextExecutionContextList, ExecutionContextContext

Access the execution_context



268
269
270
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 268

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

#fetchExecutionInstance

Fetch a ExecutionInstance

Returns:



223
224
225
226
227
228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 223

def fetch
  params = Twilio::Values.of({})

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

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

#inspectObject

Provide a detailed, user friendly representation



281
282
283
284
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 281

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

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

Access the steps

Returns:

Raises:

  • (ArgumentError)


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

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



274
275
276
277
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 274

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