Class: Twilio::REST::Conversations::V1::UserContext::UserConversationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::UserContext::UserConversationInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique ID of the Account responsible for this conversation.
-
#attributes ⇒ String
An optional string metadata field you can use to store any data you wish.
-
#chat_service_sid ⇒ String
The unique ID of the Conversation Service this conversation belongs to.
-
#context ⇒ UserConversationContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#conversation_sid ⇒ String
The unique ID of the Conversation for this User Conversation.
-
#conversation_state ⇒ user_conversation.State
The current state of this User Conversation.
-
#created_by ⇒ String
Creator of this conversation.
-
#date_created ⇒ Time
The date that this conversation was created.
-
#date_updated ⇒ Time
The date that this conversation was last updated.
-
#delete ⇒ Boolean
Delete the UserConversationInstance.
-
#fetch ⇒ UserConversationInstance
Fetch the UserConversationInstance.
-
#friendly_name ⇒ String
The human-readable name of this conversation.
-
#initialize(version, payload, user_sid: nil, conversation_sid: nil) ⇒ UserConversationInstance
constructor
Initialize the UserConversationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#last_read_message_index ⇒ String
The index of the last read Message .
-
#links ⇒ String
Absolute URLs to access the participant and conversation of this user conversation.
-
#notification_level ⇒ user_conversation.NotificationLevel
The Notification Level of this User Conversation.
-
#participant_sid ⇒ String
Participant Sid.
-
#timers ⇒ Hash
Timer date values for this conversation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#unique_name ⇒ String
An application-defined string that uniquely identifies the Conversation resource.
-
#unread_messages_count ⇒ String
The number of unread Messages in the Conversation.
-
#update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) ⇒ UserConversationInstance
Update the UserConversationInstance.
-
#url ⇒ String
The url.
-
#user_sid ⇒ String
The unique ID for the User.
Constructor Details
#initialize(version, payload, user_sid: nil, conversation_sid: nil) ⇒ UserConversationInstance
Initialize the UserConversationInstance
237 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 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 237 def initialize(version, payload, user_sid: nil, conversation_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'chat_service_sid' => payload['chat_service_sid'], 'conversation_sid' => payload['conversation_sid'], 'unread_messages_count' => payload['unread_messages_count'] == nil ? payload['unread_messages_count'] : payload['unread_messages_count'].to_i, 'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i, 'participant_sid' => payload['participant_sid'], 'user_sid' => payload['user_sid'], 'friendly_name' => payload['friendly_name'], 'conversation_state' => payload['conversation_state'], 'timers' => payload['timers'], 'attributes' => payload['attributes'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'created_by' => payload['created_by'], 'notification_level' => payload['notification_level'], 'unique_name' => payload['unique_name'], 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = { 'user_sid' => user_sid, 'conversation_sid' => conversation_sid || @properties['conversation_sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique ID of the Account responsible for this conversation.
287 288 289 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 287 def account_sid @properties['account_sid'] end |
#attributes ⇒ String
Returns An optional string metadata field you can use to store any data you wish.
347 348 349 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 347 def attributes @properties['attributes'] end |
#chat_service_sid ⇒ String
Returns The unique ID of the Conversation Service this conversation belongs to.
293 294 295 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 293 def chat_service_sid @properties['chat_service_sid'] end |
#context ⇒ UserConversationContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
274 275 276 277 278 279 280 281 282 283 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 274 def context unless @instance_context @instance_context = UserConversationContext.new( @version, @params['user_sid'], @params['conversation_sid'], ) end @instance_context end |
#conversation_sid ⇒ String
Returns The unique ID of the Conversation for this User Conversation.
299 300 301 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 299 def conversation_sid @properties['conversation_sid'] end |
#conversation_state ⇒ user_conversation.State
Returns The current state of this User Conversation.
335 336 337 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 335 def conversation_state @properties['conversation_state'] end |
#created_by ⇒ String
Returns Creator of this conversation.
365 366 367 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 365 def created_by @properties['created_by'] end |
#date_created ⇒ Time
Returns The date that this conversation was created.
353 354 355 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 353 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date that this conversation was last updated.
359 360 361 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 359 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the UserConversationInstance
413 414 415 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 413 def delete context.delete end |
#fetch ⇒ UserConversationInstance
Fetch the UserConversationInstance
420 421 422 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 420 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The human-readable name of this conversation.
329 330 331 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 329 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
433 434 435 436 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 433 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.UserConversationInstance #{values}>" end |
#last_read_message_index ⇒ String
Returns The index of the last read Message .
311 312 313 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 311 def @properties['last_read_message_index'] end |
#links ⇒ String
Returns Absolute URLs to access the participant and conversation of this user conversation.
389 390 391 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 389 def links @properties['links'] end |
#notification_level ⇒ user_conversation.NotificationLevel
Returns The Notification Level of this User Conversation.
371 372 373 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 371 def notification_level @properties['notification_level'] end |
#participant_sid ⇒ String
Returns Participant Sid.
317 318 319 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 317 def participant_sid @properties['participant_sid'] end |
#timers ⇒ Hash
Returns Timer date values for this conversation.
341 342 343 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 341 def timers @properties['timers'] end |
#to_s ⇒ Object
Provide a user friendly representation
426 427 428 429 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 426 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.UserConversationInstance #{values}>" end |
#unique_name ⇒ String
Returns An application-defined string that uniquely identifies the Conversation resource.
377 378 379 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 377 def unique_name @properties['unique_name'] end |
#unread_messages_count ⇒ String
Returns The number of unread Messages in the Conversation.
305 306 307 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 305 def @properties['unread_messages_count'] end |
#update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) ⇒ UserConversationInstance
Update the UserConversationInstance
402 403 404 405 406 407 408 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 402 def update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) context.update( notification_level: notification_level, last_read_timestamp: , last_read_message_index: , ) end |
#url ⇒ String
Returns The url.
383 384 385 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 383 def url @properties['url'] end |
#user_sid ⇒ String
Returns The unique ID for the User.
323 324 325 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 323 def user_sid @properties['user_sid'] end |