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

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

Defined Under Namespace

Classes: ExecutionStepContextContext, ExecutionStepContextInstance, ExecutionStepContextInstanceMetadata, ExecutionStepContextList, ExecutionStepContextListResponse, ExecutionStepContextPage, ExecutionStepContextPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, flow_sid, execution_sid, sid) ⇒ ExecutionStepContext

Initialize the ExecutionStepContext

Parameters:

  • version (Version)

    Version that contains the resource

  • flow_sid (String)

    The SID of the Flow with the Step to fetch.

  • execution_sid (String)

    The SID of the Execution resource with the Step to fetch.

  • sid (String)

    The SID of the ExecutionStep resource to fetch.



172
173
174
175
176
177
178
179
180
181
182
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb', line 172

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

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

    # Dependents
    @step_context = nil
end

Instance Method Details

#fetchExecutionStepInstance

Fetch the ExecutionStepInstance

Returns:



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb', line 186

def fetch

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

#fetch_with_metadataExecutionStepInstance

Fetch the ExecutionStepInstanceMetadata

Returns:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb', line 207

def 

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

#inspectObject

Provide a detailed, user friendly representation



253
254
255
256
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb', line 253

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

#step_contextExecutionStepContextList, ExecutionStepContextContext

Access the step_context



235
236
237
238
239
240
241
242
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution/execution_step.rb', line 235

def step_context
    ExecutionStepContextContext.new(
            @version,
            @solution[:flow_sid],
            @solution[:execution_sid],
            @solution[:sid]
            )
end

#to_sObject

Provide a user friendly representation



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

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