Class: Twilio::REST::Studio::V2::FlowContext::ExecutionInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, flow_sid: nil, sid: nil) ⇒ ExecutionInstance

Initialize the ExecutionInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 606

def initialize(version, payload , flow_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'flow_sid' => payload['flow_sid'],
        'contact_channel_address' => payload['contact_channel_address'],
        'contact_sid' => payload['contact_sid'],
        'flow_version' => payload['flow_version'] == nil ? payload['flow_version'] : payload['flow_version'].to_i,
        'context' => payload['context'],
        'status' => payload['status'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'initiated_by' => payload['initiated_by'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Execution resource.

Returns:



651
652
653
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 651

def 
    @properties['account_sid']
end

#contact_channel_addressString

Returns The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as ‘name@company.com`. Client identifiers are formatted `client:name`.

Returns:

  • (String)

    The phone number, SIP address or Client identifier that triggered the Execution. Phone numbers are in E.164 format (e.g. +16175551212). SIP addresses are formatted as ‘name@company.com`. Client identifiers are formatted `client:name`.



663
664
665
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 663

def contact_channel_address
    @properties['contact_channel_address']
end

#contact_sidString

Returns The SID of the Contact.

Returns:

  • (String)

    The SID of the Contact.



669
670
671
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 669

def contact_sid
    @properties['contact_sid']
end

#contextHash

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.



636
637
638
639
640
641
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 636

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



693
694
695
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 693

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



699
700
701
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 699

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the ExecutionInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



724
725
726
727
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 724

def delete

    context.delete
end

#execution_contextexecution_context

Access the execution_context

Returns:



753
754
755
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 753

def execution_context
    context.execution_context
end

#fetchExecutionInstance

Fetch the ExecutionInstance

Returns:



732
733
734
735
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 732

def fetch

    context.fetch
end

#flow_sidString

Returns The SID of the Flow.

Returns:

  • (String)

    The SID of the Flow.



657
658
659
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 657

def flow_sid
    @properties['flow_sid']
end

#flow_versionString

Returns The Flow version number at the time of Execution creation.

Returns:

  • (String)

    The Flow version number at the time of Execution creation.



675
676
677
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 675

def flow_version
    @properties['flow_version']
end

#initiated_byString

Returns The SID or identifier that triggered this Execution. For example, a Call SID if triggered by an incoming call, a Message SID if triggered by an incoming message, a Request SID if triggered by a REST API request, and so on.

Returns:

  • (String)

    The SID or identifier that triggered this Execution. For example, a Call SID if triggered by an incoming call, a Message SID if triggered by an incoming message, a Request SID if triggered by a REST API request, and so on.



705
706
707
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 705

def initiated_by
    @properties['initiated_by']
end

#inspectObject

Provide a detailed, user friendly representation



773
774
775
776
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 773

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

Returns The URLs of nested resources.

Returns:

  • (Hash)

    The URLs of nested resources.



717
718
719
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 717

def links
    @properties['links']
end

#sidString

Returns The unique string that we created to identify the Execution resource.

Returns:

  • (String)

    The unique string that we created to identify the Execution resource.



645
646
647
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 645

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


687
688
689
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 687

def status
    @properties['status']
end

#stepssteps

Access the steps

Returns:



760
761
762
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 760

def steps
    context.steps
end

#to_sObject

Provide a user friendly representation



766
767
768
769
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 766

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

#update(status: nil) ⇒ ExecutionInstance

Update the ExecutionInstance

Parameters:

  • status (Status) (defaults to: nil)

Returns:



741
742
743
744
745
746
747
748
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 741

def update(
  status: nil
)

    context.update(
        status: status, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



711
712
713
# File 'lib/twilio-ruby/rest/studio/v2/flow/execution.rb', line 711

def url
    @properties['url']
end