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.


184
185
186
187
188
189
190
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 184

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


204
205
206
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 204

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

#fetchChannelInstance

Fetch the ChannelInstance

Returns:


195
196
197
198
199
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 195

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

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

#inspectObject

Provide a detailed, user friendly representation


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

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

#to_sObject

Provide a user friendly representation


210
211
212
213
# File 'lib/twilio-ruby/rest/flex_api/v1/channel.rb', line 210

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