Class: Twilio::REST::Studio::V1::FlowContext::EngagementContext::StepContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb,
lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb

Defined Under Namespace

Classes: StepContextContext, StepContextInstance, StepContextInstanceMetadata, StepContextList, StepContextListResponse, StepContextPage, StepContextPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, flow_sid, engagement_sid, sid) ⇒ StepContext

Initialize the StepContext

Parameters:

  • version (Version)

    Version that contains the resource

  • flow_sid (String)

    The SID of the Flow with the Step to fetch.

  • engagement_sid (String)

    The SID of the Engagement with the Step to fetch.

  • sid (String)

    The SID of the Step resource to fetch.



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 164

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

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

    # Dependents
    @step_context = nil
end

Instance Method Details

#fetchStepInstance

Fetch the StepInstance

Returns:



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 178

def fetch

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

#fetch_with_metadataStepInstance

Fetch the StepInstanceMetadata

Returns:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 199

def 

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

#inspectObject

Provide a detailed, user friendly representation



245
246
247
248
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 245

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

#step_contextStepContextList, StepContextContext

Access the step_context



227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step.rb', line 227

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

#to_sObject

Provide a user friendly representation



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

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