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



190
191
192
193
194
195
196
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 190

def initialize(version, sid)
  super(version)

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

Instance Method Details

#deleteBoolean

Deletes the ChannelInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

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

#fetchChannelInstance

Fetch a ChannelInstance

Returns:



201
202
203
204
205
206
207
208
209
210
211
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 201

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

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

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

#inspectObject

Provide a detailed, user friendly representation



229
230
231
232
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 229

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

#to_sObject

Provide a user friendly representation



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

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