class Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelInstance
Public Class Methods
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
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
@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
@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
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 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 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
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
@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
@return [String] The links
# File lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb 331 def links 332 @properties['links'] 333 end
@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
@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
@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
@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
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
@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 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
@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
@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