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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, flow_sid: nil, engagement_sid: nil, step_sid: nil) ⇒ StepContextInstance

Initialize the StepContextInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this StepContext resource.

  • sid (String) —

    The SID of the Call resource to fetch.



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/engagement/step/step_context.rb', line 217

def initialize(version, payload , flow_sid: nil, engagement_sid: nil, step_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'context' => payload['context'],
        'engagement_sid' => payload['engagement_sid'],
        'flow_sid' => payload['flow_sid'],
        'step_sid' => payload['step_sid'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'flow_sid' => flow_sid  || @properties['flow_sid']  ,'engagement_sid' => engagement_sid  || @properties['engagement_sid']  ,'step_sid' => step_sid  || @properties['step_sid']  , }
end

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that created the StepContext resource.

Returns:

  • (String) —

    The SID of the Account that created the StepContext resource.



249
250
251
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 249

def 
    @properties['account_sid']
end

#context ⇒ Hash

Returns The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.

Returns:

  • (Hash) —

    The current state of the Flow's Execution. As a flow executes, we save its state in this context. We save data that your widgets can access as variables in configuration fields or in text areas as variable substitution.



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

def context
    unless @instance_context
        @instance_context = StepContextContext.new(@version , @params['flow_sid'], @params['engagement_sid'], @params['step_sid'])
    end
    @instance_context
end

#engagement_sid ⇒ String

Returns The SID of the Engagement.

Returns:

  • (String) —

    The SID of the Engagement.



261
262
263
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 261

def engagement_sid
    @properties['engagement_sid']
end

#fetch ⇒ StepContextInstance

Fetch the StepContextInstance

Returns:



286
287
288
289
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 286

def fetch

    context.fetch
end

#flow_sid ⇒ String

Returns The SID of the Flow.

Returns:

  • (String) —

    The SID of the Flow.



267
268
269
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 267

def flow_sid
    @properties['flow_sid']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



300
301
302
303
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 300

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Studio.V1.StepContextInstance #{values}>"
end

#step_sid ⇒ String

Returns The SID of the Step the context is associated with.

Returns:

  • (String) —

    The SID of the Step the context is associated with.



273
274
275
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 273

def step_sid
    @properties['step_sid']
end

#to_s ⇒ Object

Provide a user friendly representation



293
294
295
296
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 293

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Studio.V1.StepContextInstance #{values}>"
end

#url ⇒ String

Returns The absolute URL of the resource.

Returns:

  • (String) —

    The absolute URL of the resource.



279
280
281
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/step/step_context.rb', line 279

def url
    @properties['url']
end