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 unique SID identifier of the Flex Chat Channel



179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 179

def initialize(version, sid)
  super(version)

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

Instance Method Details

#deleteBoolean

Deletes the WebChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



226
227
228
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 226

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

#fetchWebChannelInstance

Fetch a WebChannelInstance

Returns:



190
191
192
193
194
195
196
197
198
199
200
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 190

def fetch
  params = Twilio::Values.of({})

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

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

#inspectObject

Provide a detailed, user friendly representation



239
240
241
242
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 239

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

#to_sObject

Provide a user friendly representation



232
233
234
235
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 232

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)

    Chat status, can only used to make chat ‘inactive’

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

    Post-engagement data

Returns:



208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 208

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