Class: Twilio::REST::Studio::V1::FlowContext::ExecutionContext::ExecutionContextInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, flow_sid: nil, execution_sid: nil) ⇒ ExecutionContextInstance

Initialize the ExecutionContextInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb', line 213

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

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

Instance Method Details

#account_sid ⇒ String

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

Returns:

  • (String) —

    The SID of the Account that created the ExecutionContext resource.



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

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.



235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb', line 235

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

#execution_sid ⇒ String

Returns The SID of the context's Execution resource.

Returns:

  • (String) —

    The SID of the context's Execution resource.



262
263
264
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb', line 262

def execution_sid
    @properties['execution_sid']
end

#fetch ⇒ ExecutionContextInstance

Fetch the ExecutionContextInstance

Returns:



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

def fetch

    context.fetch
end

#flow_sid ⇒ String

Returns The SID of the Flow.

Returns:

  • (String) —

    The SID of the Flow.



256
257
258
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb', line 256

def flow_sid
    @properties['flow_sid']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



289
290
291
292
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb', line 289

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

#to_s ⇒ Object

Provide a user friendly representation



282
283
284
285
# File 'lib/twilio-ruby/rest/studio/v1/flow/execution/execution_context.rb', line 282

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

#url ⇒ String

Returns The absolute URL of the resource.

Returns:

  • (String) —

    The absolute URL of the resource.



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

def url
    @properties['url']
end