Class: Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelInstance
- Inherits:
-
Twilio::REST::InstanceResource
- Object
- Twilio::REST::InstanceResource
- Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserChannelInstance
- Defined in:
- lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb
Instance Method Summary collapse
- #account_sid ⇒ String
- #channel_sid ⇒ String
-
#context ⇒ UserChannelContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#delete ⇒ Boolean
Delete the UserChannelInstance.
-
#fetch ⇒ UserChannelInstance
Fetch the UserChannelInstance.
-
#initialize(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil) ⇒ UserChannelInstance
constructor
Initialize the UserChannelInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
- #last_consumed_message_index ⇒ String
- #links ⇒ Hash
- #member_sid ⇒ String
- #notification_level ⇒ NotificationLevel
- #service_sid ⇒ String
- #status ⇒ ChannelStatus
-
#to_s ⇒ Object
Provide a user friendly representation.
- #unread_messages_count ⇒ String
-
#update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstance.
- #url ⇒ String
- #user_sid ⇒ String
Constructor Details
#initialize(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil) ⇒ UserChannelInstance
Initialize the UserChannelInstance
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 251 def initialize(version, payload , service_sid: nil, user_sid: nil, channel_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'service_sid' => payload['service_sid'], 'channel_sid' => payload['channel_sid'], 'user_sid' => payload['user_sid'], 'member_sid' => payload['member_sid'], 'status' => payload['status'], 'last_consumed_message_index' => payload['last_consumed_message_index'] == nil ? payload['last_consumed_message_index'] : payload['last_consumed_message_index'].to_i, 'unread_messages_count' => payload['unread_messages_count'] == nil ? payload['unread_messages_count'] : payload['unread_messages_count'].to_i, 'links' => payload['links'], 'url' => payload['url'], 'notification_level' => payload['notification_level'], } # Context @instance_context = nil @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'user_sid' => user_sid || @properties['user_sid'] ,'channel_sid' => channel_sid || @properties['channel_sid'] , } end |
Instance Method Details
#account_sid ⇒ String
287 288 289 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 287 def account_sid @properties['account_sid'] end |
#channel_sid ⇒ String
299 300 301 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 299 def channel_sid @properties['channel_sid'] end |
#context ⇒ UserChannelContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
278 279 280 281 282 283 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 278 def context unless @instance_context @instance_context = UserChannelContext.new(@version , @params['service_sid'], @params['user_sid'], @params['channel_sid']) end @instance_context end |
#delete ⇒ Boolean
Delete the UserChannelInstance
354 355 356 357 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 354 def delete context.delete end |
#fetch ⇒ UserChannelInstance
Fetch the UserChannelInstance
362 363 364 365 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 362 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
395 396 397 398 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 395 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.IpMessaging.V2.UserChannelInstance #{values}>" end |
#last_consumed_message_index ⇒ String
323 324 325 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 323 def @properties['last_consumed_message_index'] end |
#links ⇒ Hash
335 336 337 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 335 def links @properties['links'] end |
#member_sid ⇒ String
311 312 313 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 311 def member_sid @properties['member_sid'] end |
#notification_level ⇒ NotificationLevel
347 348 349 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 347 def notification_level @properties['notification_level'] end |
#service_sid ⇒ String
293 294 295 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 293 def service_sid @properties['service_sid'] end |
#status ⇒ ChannelStatus
317 318 319 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 317 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
388 389 390 391 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 388 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.IpMessaging.V2.UserChannelInstance #{values}>" end |
#unread_messages_count ⇒ String
329 330 331 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 329 def @properties['unread_messages_count'] end |
#update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstance
373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 373 def update( notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset ) context.update( notification_level: notification_level, last_consumed_message_index: , last_consumption_timestamp: , ) end |
#url ⇒ String
341 342 343 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 341 def url @properties['url'] end |
#user_sid ⇒ String
305 306 307 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 305 def user_sid @properties['user_sid'] end |