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 SID of the Flow with the Execution resources to update.

  • sid (String)

    The SID of the Execution resource to update.



176
177
178
179
180
181
182
183
184
185
186
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 176

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

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



190
191
192
193
194
195
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 190

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    @version.delete('DELETE', @uri, headers: headers)
end

#execution_contextExecutionContextList, ExecutionContextContext

Access the execution_context



240
241
242
243
244
245
246
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 240

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

#fetchExecutionInstance

Fetch the ExecutionInstance

Returns:



200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 200

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

#inspectObject

Provide a detailed, user friendly representation



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

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)


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution.rb', line 251

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



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

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

#update(status: nil) ⇒ ExecutionInstance

Update the ExecutionInstance

Parameters:

  • status (Status) (defaults to: nil)

Returns:



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

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