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
The account_sid.
-
#channel_sid ⇒ String
The channel_sid.
-
#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
The last_consumed_message_index.
-
#links ⇒ String
The links.
-
#member_sid ⇒ String
The member_sid.
-
#notification_level ⇒ user_channel.NotificationLevel
The notification_level.
-
#service_sid ⇒ String
The service_sid.
-
#status ⇒ user_channel.ChannelStatus
The status.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#unread_messages_count ⇒ String
The unread_messages_count.
-
#update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstance.
-
#url ⇒ String
The url.
-
#user_sid ⇒ String
The user_sid.
Constructor Details
#initialize(version, payload, service_sid: nil, user_sid: nil, channel_sid: nil) ⇒ UserChannelInstance
Initialize the UserChannelInstance
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 238 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, 'user_sid' => user_sid, 'channel_sid' => channel_sid || @properties['channel_sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The account_sid.
283 284 285 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 283 def account_sid @properties['account_sid'] end |
#channel_sid ⇒ String
Returns The channel_sid.
295 296 297 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 295 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
269 270 271 272 273 274 275 276 277 278 279 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 269 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
357 358 359 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 357 def delete context.delete end |
#fetch ⇒ UserChannelInstance
Fetch the UserChannelInstance
350 351 352 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 350 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
385 386 387 388 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 385 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.IpMessaging.V2.UserChannelInstance #{values}>" end |
#last_consumed_message_index ⇒ String
Returns The last_consumed_message_index.
319 320 321 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 319 def @properties['last_consumed_message_index'] end |
#links ⇒ String
Returns The links.
331 332 333 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 331 def links @properties['links'] end |
#member_sid ⇒ String
Returns The member_sid.
307 308 309 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 307 def member_sid @properties['member_sid'] end |
#notification_level ⇒ user_channel.NotificationLevel
Returns The notification_level.
343 344 345 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 343 def notification_level @properties['notification_level'] end |
#service_sid ⇒ String
Returns The service_sid.
289 290 291 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 289 def service_sid @properties['service_sid'] end |
#status ⇒ user_channel.ChannelStatus
Returns The status.
313 314 315 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 313 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
378 379 380 381 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 378 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.IpMessaging.V2.UserChannelInstance #{values}>" end |
#unread_messages_count ⇒ String
Returns The unread_messages_count.
325 326 327 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 325 def @properties['unread_messages_count'] end |
#update(notification_level: :unset, last_consumed_message_index: :unset, last_consumption_timestamp: :unset) ⇒ UserChannelInstance
Update the UserChannelInstance
368 369 370 371 372 373 374 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 368 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
Returns The url.
337 338 339 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 337 def url @properties['url'] end |
#user_sid ⇒ String
Returns The user_sid.
301 302 303 |
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_channel.rb', line 301 def user_sid @properties['user_sid'] end |