Class: Twilio::REST::Studio::V2::FlowInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ FlowInstance

Initialize the FlowInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



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

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'author_sid' => payload['author_sid'],
        'friendly_name' => payload['friendly_name'],
        'definition' => payload['definition'],
        'status' => payload['status'],
        'revision' => payload['revision'] == nil ? payload['revision'] : payload['revision'].to_i,
        'commit_message' => payload['commit_message'],
        'valid' => payload['valid'],
        'errors' => payload['errors'],
        'warnings' => payload['warnings'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'webhook_url' => payload['webhook_url'],
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { '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 Flow resource.

Returns:



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

def 
    @properties['account_sid']
end

#author_sidString

Returns The SID of the User that created or last updated the Flow.

Returns:

  • (String)

    The SID of the User that created or last updated the Flow.



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

def author_sid
    @properties['author_sid']
end

#commit_messageString

Returns Description of change made in the revision.

Returns:

  • (String)

    Description of change made in the revision.



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

def commit_message
    @properties['commit_message']
end

#contextFlowContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



641
642
643
644
645
646
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 641

def context
    unless @instance_context
        @instance_context = FlowContext.new(@version , @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:



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

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:



722
723
724
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 722

def date_updated
    @properties['date_updated']
end

#definitionHash

Returns JSON representation of flow definition.

Returns:

  • (Hash)

    JSON representation of flow definition.



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

def definition
    @properties['definition']
end

#deleteBoolean

Delete the FlowInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



747
748
749
750
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 747

def delete

    context.delete
end

#errorsArray<Hash>

Returns List of error in the flow definition.

Returns:

  • (Array<Hash>)

    List of error in the flow definition.



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

def errors
    @properties['errors']
end

#executionsexecutions

Access the executions

Returns:



785
786
787
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 785

def executions
    context.executions
end

#fetchFlowInstance

Fetch the FlowInstance

Returns:



755
756
757
758
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 755

def fetch

    context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the Flow.

Returns:

  • (String)

    The string that you assigned to describe the Flow.



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

def friendly_name
    @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



812
813
814
815
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 812

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

Returns The URLs of the Flow’s nested resources.

Returns:

  • (Hash)

    The URLs of the Flow’s nested resources.



740
741
742
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 740

def links
    @properties['links']
end

#revisionString

Returns The latest revision number of the Flow’s definition.

Returns:

  • (String)

    The latest revision number of the Flow’s definition.



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

def revision
    @properties['revision']
end

#revisionsrevisions

Access the revisions

Returns:



799
800
801
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 799

def revisions
    context.revisions
end

#sidString

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

Returns:

  • (String)

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



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

def sid
    @properties['sid']
end

#statusStatus

Returns:

  • (Status)


680
681
682
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 680

def status
    @properties['status']
end

#test_userstest_users

Access the test_users

Returns:



792
793
794
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 792

def test_users
    context.test_users
end

#to_sObject

Provide a user friendly representation



805
806
807
808
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 805

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

#update(status: nil, friendly_name: :unset, definition: :unset, commit_message: :unset) ⇒ FlowInstance

Update the FlowInstance

Parameters:

  • status (Status) (defaults to: nil)
  • friendly_name (String) (defaults to: :unset)

    The string that you assigned to describe the Flow.

  • definition (Object) (defaults to: :unset)

    JSON representation of flow definition.

  • commit_message (String) (defaults to: :unset)

    Description of change made in the revision.

Returns:



767
768
769
770
771
772
773
774
775
776
777
778
779
780
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 767

def update(
    status: nil, 
    friendly_name: :unset, 
    definition: :unset, 
    commit_message: :unset
)

    context.update(
        status: status, 
        friendly_name: friendly_name, 
        definition: definition, 
        commit_message: commit_message, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



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

def url
    @properties['url']
end

#validBoolean

Returns Boolean if the flow definition is valid.

Returns:

  • (Boolean)

    Boolean if the flow definition is valid.



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

def valid
    @properties['valid']
end

#warningsArray<Hash>

Returns List of warnings in the flow definition.

Returns:

  • (Array<Hash>)

    List of warnings in the flow definition.



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

def warnings
    @properties['warnings']
end

#webhook_urlString

Returns:

  • (String)


728
729
730
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 728

def webhook_url
    @properties['webhook_url']
end