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 that contains the resource

  • The SID of the WebChannel resource to update.



253
254
255
256
257
258
259
260
261
262
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 253

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the WebChannelInstance

Returns:

  • True if delete succeeds, false otherwise



266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 266

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the WebChannelInstanceMetadata

Returns:

  • True if delete succeeds, false otherwise



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 279

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      webChannel_instance = WebChannelInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      WebChannelInstanceMetadata.new(@version, webChannel_instance, response.headers, response.status_code)
end

#fetchWebChannelInstance

Fetch the WebChannelInstance

Returns:

  • Fetched WebChannelInstance



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 298

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    WebChannelInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataWebChannelInstance

Fetch the WebChannelInstanceMetadata

Returns:

  • Fetched WebChannelInstance



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 317

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    web_channel_instance = WebChannelInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    WebChannelInstanceMetadata.new(
        @version,
        web_channel_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



413
414
415
416
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 413

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

#to_sObject

Provide a user friendly representation



406
407
408
409
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 406

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:

  • (defaults to: :unset)
  • (defaults to: :unset)

    The post-engagement data.

Returns:

  • Updated WebChannelInstance



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 344

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

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    WebChannelInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

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

Update the WebChannelInstanceMetadata

Parameters:

  • (defaults to: :unset)
  • (defaults to: :unset)

    The post-engagement data.

Returns:

  • Updated WebChannelInstance



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/twilio-ruby/rest/flex_api/v1/web_channel.rb', line 373

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

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    web_channel_instance = WebChannelInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    WebChannelInstanceMetadata.new(
        @version,
        web_channel_instance,
        response.headers,
        response.status_code
    )
end