class Twilio::REST::IpMessaging::V1::ServiceContext::ChannelContext

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the ChannelContext @param [Version] version Version that contains the resource @param [String] service_sid The service_sid @param [String] sid The sid @return [ChannelContext] ChannelContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
175 def initialize(version, service_sid, sid)
176   super(version)
177 
178   # Path Solution
179   @solution = {service_sid: service_sid, sid: sid, }
180   @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:sid]}"
181 
182   # Dependents
183   @members = nil
184   @messages = nil
185   @invites = nil
186 end

Public Instance Methods

delete() click to toggle source

Delete the ChannelInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
200 def delete
201    @version.delete('DELETE', @uri)
202 end
fetch() click to toggle source

Fetch the ChannelInstance @return [ChannelInstance] Fetched ChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
191 def fetch
192   payload = @version.fetch('GET', @uri)
193 
194   ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
195 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
297 def inspect
298   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
299   "#<Twilio.IpMessaging.V1.ChannelContext #{context}>"
300 end
invites(sid=:unset) click to toggle source

Access the invites @return [InviteList] @return [InviteContext] if sid was passed.

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
270 def invites(sid=:unset)
271   raise ArgumentError, 'sid cannot be nil' if sid.nil?
272 
273   if sid != :unset
274     return InviteContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
275   end
276 
277   unless @invites
278     @invites = InviteList.new(
279         @version,
280         service_sid: @solution[:service_sid],
281         channel_sid: @solution[:sid],
282     )
283   end
284 
285   @invites
286 end
members(sid=:unset) click to toggle source

Access the members @return [MemberList] @return [MemberContext] if sid was passed.

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
226 def members(sid=:unset)
227   raise ArgumentError, 'sid cannot be nil' if sid.nil?
228 
229   if sid != :unset
230     return MemberContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
231   end
232 
233   unless @members
234     @members = MemberList.new(
235         @version,
236         service_sid: @solution[:service_sid],
237         channel_sid: @solution[:sid],
238     )
239   end
240 
241   @members
242 end
messages(sid=:unset) click to toggle source

Access the messages @return [MessageList] @return [MessageContext] if sid was passed.

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
248 def messages(sid=:unset)
249   raise ArgumentError, 'sid cannot be nil' if sid.nil?
250 
251   if sid != :unset
252     return MessageContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
253   end
254 
255   unless @messages
256     @messages = MessageList.new(
257         @version,
258         service_sid: @solution[:service_sid],
259         channel_sid: @solution[:sid],
260     )
261   end
262 
263   @messages
264 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
290 def to_s
291   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
292   "#<Twilio.IpMessaging.V1.ChannelContext #{context}>"
293 end
update(friendly_name: :unset, unique_name: :unset, attributes: :unset) click to toggle source

Update the ChannelInstance @param [String] friendly_name The friendly_name @param [String] unique_name The unique_name @param [String] attributes The attributes @return [ChannelInstance] Updated ChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb
210 def update(friendly_name: :unset, unique_name: :unset, attributes: :unset)
211   data = Twilio::Values.of({
212       'FriendlyName' => friendly_name,
213       'UniqueName' => unique_name,
214       'Attributes' => attributes,
215   })
216 
217   payload = @version.update('POST', @uri, data: data)
218 
219   ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
220 end