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

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

Instance Method Summary collapse

Constructor Details

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

Initialize the EngagementContextInstance

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 EngagementContext resource.

  • sid (String)

    The SID of the Call resource to fetch.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 272

def initialize(version, payload , flow_sid: nil, engagement_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'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the Account.

Returns:

  • (String)

    The SID of the Account.



303
304
305
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 303

def 
    @properties['account_sid']
end

#contextHash

Returns As your flow executes, we save the state in what’s called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution.

Returns:

  • (Hash)

    As your flow executes, we save the state in what’s called the Flow Context. Any data in the flow context can be accessed by your widgets as variables, either in configuration fields or in text areas as variable substitution.



294
295
296
297
298
299
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 294

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

#engagement_sidString

Returns The SID of the Engagement.

Returns:

  • (String)

    The SID of the Engagement.



315
316
317
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 315

def engagement_sid
    @properties['engagement_sid']
end

#fetchEngagementContextInstance

Fetch the EngagementContextInstance

Returns:



334
335
336
337
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 334

def fetch

    context.fetch
end

#flow_sidString

Returns The SID of the Flow.

Returns:

  • (String)

    The SID of the Flow.



321
322
323
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 321

def flow_sid
    @properties['flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



348
349
350
351
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 348

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

#to_sObject

Provide a user friendly representation



341
342
343
344
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 341

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

#urlString

Returns The URL of the resource.

Returns:

  • (String)

    The URL of the resource.



327
328
329
# File 'lib/twilio-ruby/rest/studio/v1/flow/engagement/engagement_context.rb', line 327

def url
    @properties['url']
end