Class: Twilio::REST::FlexApi::V1::WebChannelContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ WebChannelContext

Initialize the WebChannelContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the WebChannel resource to fetch.


172
173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 172

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {sid: sid, }
  @uri = "/WebChannels/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Delete the WebChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


209
210
211
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 209

def delete
   @version.delete('DELETE', @uri)
end

#fetchWebChannelInstance

Fetch the WebChannelInstance

Returns:


183
184
185
186
187
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 183

def fetch
  payload = @version.fetch('GET', @uri)

  WebChannelInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


222
223
224
225
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 222

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.FlexApi.V1.WebChannelContext #{context}>"
end

#to_sObject

Provide a user friendly representation


215
216
217
218
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 215

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.FlexApi.V1.WebChannelContext #{context}>"
end

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

Update the WebChannelInstance

Parameters:

  • chat_status (web_channel.ChatStatus) (defaults to: :unset)

    The chat status. Can only be `inactive`.

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

    The post-engagement data.

Returns:


195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 195

def update(chat_status: :unset, post_engagement_data: :unset)
  data = Twilio::Values.of({
      'ChatStatus' => chat_status,
      'PostEngagementData' => post_engagement_data,
  })

  payload = @version.update('POST', @uri, data: data)

  WebChannelInstance.new(@version, payload, sid: @solution[:sid], )
end