class Twilio::REST::IpMessaging::V2::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/v2/service/channel.rb
184 def initialize(version, service_sid, sid)
185   super(version)
186 
187   # Path Solution
188   @solution = {service_sid: service_sid, sid: sid, }
189   @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:sid]}"
190 
191   # Dependents
192   @members = nil
193   @messages = nil
194   @invites = nil
195   @webhooks = nil
196 end

Public Instance Methods

delete(x_twilio_webhook_enabled: :unset) click to toggle source

Delete the ChannelInstance @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

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

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb
212 def delete(x_twilio_webhook_enabled: :unset)
213   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
214 
215    @version.delete('DELETE', @uri, headers: headers)
216 end
fetch() click to toggle source

Fetch the ChannelInstance @return [ChannelInstance] Fetched ChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb
201 def fetch
202   payload = @version.fetch('GET', @uri)
203 
204   ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
205 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb
342 def inspect
343   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
344   "#<Twilio.IpMessaging.V2.ChannelContext #{context}>"
345 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/v2/service/channel.rb
293 def invites(sid=:unset)
294   raise ArgumentError, 'sid cannot be nil' if sid.nil?
295 
296   if sid != :unset
297     return InviteContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
298   end
299 
300   unless @invites
301     @invites = InviteList.new(
302         @version,
303         service_sid: @solution[:service_sid],
304         channel_sid: @solution[:sid],
305     )
306   end
307 
308   @invites
309 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/v2/service/channel.rb
249 def members(sid=:unset)
250   raise ArgumentError, 'sid cannot be nil' if sid.nil?
251 
252   if sid != :unset
253     return MemberContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
254   end
255 
256   unless @members
257     @members = MemberList.new(
258         @version,
259         service_sid: @solution[:service_sid],
260         channel_sid: @solution[:sid],
261     )
262   end
263 
264   @members
265 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/v2/service/channel.rb
271 def messages(sid=:unset)
272   raise ArgumentError, 'sid cannot be nil' if sid.nil?
273 
274   if sid != :unset
275     return MessageContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
276   end
277 
278   unless @messages
279     @messages = MessageList.new(
280         @version,
281         service_sid: @solution[:service_sid],
282         channel_sid: @solution[:sid],
283     )
284   end
285 
286   @messages
287 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb
335 def to_s
336   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
337   "#<Twilio.IpMessaging.V2.ChannelContext #{context}>"
338 end
update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset, x_twilio_webhook_enabled: :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 @param [Time] date_created The date_created @param [Time] date_updated The date_updated @param [String] created_by The created_by @param [channel.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [ChannelInstance] Updated ChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb
229 def update(friendly_name: :unset, unique_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset, x_twilio_webhook_enabled: :unset)
230   data = Twilio::Values.of({
231       'FriendlyName' => friendly_name,
232       'UniqueName' => unique_name,
233       'Attributes' => attributes,
234       'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
235       'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
236       'CreatedBy' => created_by,
237   })
238   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
239 
240   payload = @version.update('POST', @uri, data: data, headers: headers)
241 
242   ChannelInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
243 end
webhooks(sid=:unset) click to toggle source

Access the webhooks @return [WebhookList] @return [WebhookContext] if sid was passed.

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb
315 def webhooks(sid=:unset)
316   raise ArgumentError, 'sid cannot be nil' if sid.nil?
317 
318   if sid != :unset
319     return WebhookContext.new(@version, @solution[:service_sid], @solution[:sid], sid, )
320   end
321 
322   unless @webhooks
323     @webhooks = WebhookList.new(
324         @version,
325         service_sid: @solution[:service_sid],
326         channel_sid: @solution[:sid],
327     )
328   end
329 
330   @webhooks
331 end