Class: Twilio::REST::FlexApi::V1::ChannelContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ChannelContext

Initialize the ChannelContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Flex chat channel resource to fetch.



269
270
271
272
273
274
275
276
277
278
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 269

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the ChannelInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



282
283
284
285
286
287
288
289
290
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 282

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 ChannelInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 295

def 

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

#fetchChannelInstance

Fetch the ChannelInstance

Returns:



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 314

def fetch

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

#fetch_with_metadataChannelInstance

Fetch the ChannelInstanceMetadata

Returns:



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 333

def 

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

#inspectObject

Provide a detailed, user friendly representation



365
366
367
368
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 365

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

#to_sObject

Provide a user friendly representation



358
359
360
361
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 358

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