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.



628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 628

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_sid ⇒ String

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

Returns:

  • (String) —

    The SID of the Account that created the Flow resource.



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

def 
    @properties['account_sid']
end

#author_sid ⇒ String

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.



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

def author_sid
    @properties['author_sid']
end

#commit_message ⇒ String

Returns Description of change made in the revision.

Returns:

  • (String) —

    Description of change made in the revision.



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

def commit_message
    @properties['commit_message']
end

#context ⇒ FlowContext

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

Returns:



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

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

#date_created ⇒ Time

Returns The date and time in GMT when the resource was created specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in GMT when the resource was created specified in ISO 8601 format.



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

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The date and time in GMT when the resource was last updated specified in ISO 8601 format.

Returns:

  • (Time) —

    The date and time in GMT when the resource was last updated specified in ISO 8601 format.



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

def date_updated
    @properties['date_updated']
end

#definition ⇒ Hash

Returns JSON representation of flow definition.

Returns:

  • (Hash) —

    JSON representation of flow definition.



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

def definition
    @properties['definition']
end

#delete ⇒ Boolean

Delete the FlowInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#errors ⇒ Array<Hash>

Returns List of error in the flow definition.

Returns:

  • (Array<Hash>) —

    List of error in the flow definition.



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

def errors
    @properties['errors']
end

#executions ⇒ executions

Access the executions

Returns:



808
809
810
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 808

def executions
    context.executions
end

#fetch ⇒ FlowInstance

Fetch the FlowInstance

Returns:



775
776
777
778
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 775

def fetch

    context.fetch
end

#friendly_name ⇒ String

Returns The string that you assigned to describe the Flow.

Returns:

  • (String) —

    The string that you assigned to describe the Flow.



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

def friendly_name
    @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



835
836
837
838
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 835

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.



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

def links
    @properties['links']
end

#revision ⇒ String

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

Returns:

  • (String) —

    The latest revision number of the Flow's definition.



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

def revision
    @properties['revision']
end

#revisions ⇒ revisions

Access the revisions

Returns:



822
823
824
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 822

def revisions
    context.revisions
end

#sid ⇒ String

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.



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

def sid
    @properties['sid']
end

#status ⇒ Status

Returns:

  • (Status)


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

def status
    @properties['status']
end

#test_users ⇒ test_users

Access the test_users

Returns:



815
816
817
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 815

def test_users
    context.test_users
end

#to_s ⇒ Object

Provide a user friendly representation



828
829
830
831
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 828

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, author_sid: :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.

  • author_sid (String) (defaults to: :unset) —

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

Returns:



788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
# File 'lib/twilio-ruby/rest/studio/v2/flow.rb', line 788

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

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

#url ⇒ String

Returns The absolute URL of the resource.

Returns:

  • (String) —

    The absolute URL of the resource.



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

def url
    @properties['url']
end

#valid ⇒ Boolean

Returns Boolean if the flow definition is valid.

Returns:

  • (Boolean) —

    Boolean if the flow definition is valid.



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

def valid
    @properties['valid']
end

#warnings ⇒ Array<Hash>

Returns List of warnings in the flow definition.

Returns:

  • (Array<Hash>) —

    List of warnings in the flow definition.



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

def warnings
    @properties['warnings']
end

#webhook_url ⇒ String

Returns:

  • (String)


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

def webhook_url
    @properties['webhook_url']
end