class Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelInstance

Public Class Methods

new(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil) click to toggle source

Initialize the UserChannelInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The service_sid @param [String] user_sid The user_sid @param [String] channel_sid The channel_sid @return [UserChannelInstance] UserChannelInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
238 def initialize(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil)
239   super(version)
240 
241   # Marshaled Properties
242   @properties = {
243       'account_sid' => payload['account_sid'],
244       'service_sid' => payload['service_sid'],
245       'channel_sid' => payload['channel_sid'],
246       'user_sid' => payload['user_sid'],
247       'member_sid' => payload['member_sid'],
248       'status' => payload['status'],
249       'last_consumed_message_index' => payload['last_consumed_message_index'] == nil ? payload['last_consumed_message_index'] : payload['last_consumed_message_index'].to_i,
250       'unread_messages_count' => payload['unread_messages_count'] == nil ? payload['unread_messages_count'] : payload['unread_messages_count'].to_i,
251       'links' => payload['links'],
252       'url' => payload['url'],
253       'notification_level' => payload['notification_level'],
254   }
255 
256   # Context
257   @instance_context = nil
258   @params = {
259       'service_sid' => service_sid,
260       'user_sid' => user_sid,
261       'channel_sid' => channel_sid || @properties['channel_sid'],
262   }
263 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The account_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
283 def account_sid
284   @properties['account_sid']
285 end
channel_sid() click to toggle source

@return [String] The channel_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
295 def channel_sid
296   @properties['channel_sid']
297 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [UserChannelContext] UserChannelContext for this UserChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
269 def context
270   unless @instance_context
271     @instance_context = UserChannelContext.new(
272         @version,
273         @params['service_sid'],
274         @params['user_sid'],
275         @params['channel_sid'],
276     )
277   end
278   @instance_context
279 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
357 def delete
358   context.delete
359 end
fetch() click to toggle source

Fetch the UserChannelInstance @return [UserChannelInstance] Fetched UserChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
350 def fetch
351   context.fetch
352 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
385 def inspect
386   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
387   "<Twilio.IpMessaging.V2.UserChannelInstance #{values}>"
388 end
last_consumed_message_index() click to toggle source

@return [String] The last_consumed_message_index

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
319 def last_consumed_message_index
320   @properties['last_consumed_message_index']
321 end
member_sid() click to toggle source

@return [String] The member_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
307 def member_sid
308   @properties['member_sid']
309 end
notification_level() click to toggle source

@return [user_channel.NotificationLevel] The notification_level

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
343 def notification_level
344   @properties['notification_level']
345 end
service_sid() click to toggle source

@return [String] The service_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
289 def service_sid
290   @properties['service_sid']
291 end
status() click to toggle source

@return [user_channel.ChannelStatus] The status

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
313 def status
314   @properties['status']
315 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
378 def to_s
379   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
380   "<Twilio.IpMessaging.V2.UserChannelInstance #{values}>"
381 end
unread_messages_count() click to toggle source

@return [String] The unread_messages_count

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
325 def unread_messages_count
326   @properties['unread_messages_count']
327 end
update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) click to toggle source

Update the UserChannelInstance @param [user_channel.NotificationLevel] notification_level The

notification_level

@param [String] last_consumed_message_index The last_consumed_message_index @param [Time] last_consumption_timestamp The last_consumption_timestamp @return [UserChannelInstance] Updated UserChannelInstance

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
368 def update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset)
369   context.update(
370       notification_level: notification_level,
371       last_consumed_message_index: last_consumed_message_index,
372       last_consumption_timestamp: last_consumption_timestamp,
373   )
374 end
url() click to toggle source

@return [String] The url

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
337 def url
338   @properties['url']
339 end
user_sid() click to toggle source

@return [String] The user_sid

    # File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
301 def user_sid
302   @properties['user_sid']
303 end