Class: Twilio::REST::FlexApi::V1::WebChannelInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/web_channel.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the WebChannelInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 557

def initialize(version, payload , sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'flex_flow_sid' => payload['flex_flow_sid'],
        'sid' => payload['sid'],
        'url' => payload['url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
    }

    # 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 WebChannel resource and owns this Workflow.

Returns:



589
590
591
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 589

def 
    @properties['account_sid']
end

#contextWebChannelContext

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

Returns:



580
581
582
583
584
585
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 580

def context
    unless @instance_context
        @instance_context = WebChannelContext.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:



613
614
615
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 613

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:



619
620
621
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 619

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the WebChannelInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



626
627
628
629
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 626

def delete

    context.delete
end

#fetchWebChannelInstance

Fetch the WebChannelInstance

Returns:



634
635
636
637
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 634

def fetch

    context.fetch
end

#flex_flow_sidString

Returns The SID of the Flex Flow.

Returns:

  • (String)

    The SID of the Flex Flow.



595
596
597
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 595

def flex_flow_sid
    @properties['flex_flow_sid']
end

#inspectObject

Provide a detailed, user friendly representation



664
665
666
667
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 664

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

#sidString

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

Returns:

  • (String)

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



601
602
603
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 601

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



657
658
659
660
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 657

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

#update(chat_status: :unset, post_engagement_data: :unset) ⇒ WebChannelInstance

Update the WebChannelInstance

Parameters:

  • chat_status (ChatStatus) (defaults to: :unset)
  • post_engagement_data (String) (defaults to: :unset)

    The post-engagement data.

Returns:



644
645
646
647
648
649
650
651
652
653
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 644

def update(
    chat_status: :unset, 
    post_engagement_data: :unset
)

    context.update(
        chat_status: chat_status, 
        post_engagement_data: post_engagement_data, 
    )
end

#urlString

Returns The absolute URL of the WebChannel resource.

Returns:

  • (String)

    The absolute URL of the WebChannel resource.



607
608
609
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 607

def url
    @properties['url']
end