class Twilio::REST::Conversations::V1::UserContext::UserConversationInstance

Public Class Methods

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

Initialize the UserConversationInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] user_sid The unique string that identifies the {User

resource}[https://www.twilio.com/docs/conversations/api/user-resource].

@param [String] conversation_sid The unique SID identifier of the Conversation.

This value can be either the `sid` or the `unique_name` of the {Conversation
resource}[https://www.twilio.com/docs/conversations/api/conversation-resource].

@return [UserConversationInstance] UserConversationInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
237 def initialize(version, payload, user_sid: nil, conversation_sid: nil)
238   super(version)
239 
240   # Marshaled Properties
241   @properties = {
242       'account_sid' => payload['account_sid'],
243       'chat_service_sid' => payload['chat_service_sid'],
244       'conversation_sid' => payload['conversation_sid'],
245       'unread_messages_count' => payload['unread_messages_count'] == nil ? payload['unread_messages_count'] : payload['unread_messages_count'].to_i,
246       'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i,
247       'participant_sid' => payload['participant_sid'],
248       'user_sid' => payload['user_sid'],
249       'friendly_name' => payload['friendly_name'],
250       'conversation_state' => payload['conversation_state'],
251       'timers' => payload['timers'],
252       'attributes' => payload['attributes'],
253       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
254       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
255       'created_by' => payload['created_by'],
256       'notification_level' => payload['notification_level'],
257       'unique_name' => payload['unique_name'],
258       'url' => payload['url'],
259       'links' => payload['links'],
260   }
261 
262   # Context
263   @instance_context = nil
264   @params = {
265       'user_sid' => user_sid,
266       'conversation_sid' => conversation_sid || @properties['conversation_sid'],
267   }
268 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The unique ID of the Account responsible for this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
287 def account_sid
288   @properties['account_sid']
289 end
attributes() click to toggle source

@return [String] An optional string metadata field you can use to store any data you wish.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
347 def attributes
348   @properties['attributes']
349 end
chat_service_sid() click to toggle source

@return [String] The unique ID of the Conversation Service this conversation belongs to.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
293 def chat_service_sid
294   @properties['chat_service_sid']
295 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 [UserConversationContext] UserConversationContext for this UserConversationInstance

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
274 def context
275   unless @instance_context
276     @instance_context = UserConversationContext.new(
277         @version,
278         @params['user_sid'],
279         @params['conversation_sid'],
280     )
281   end
282   @instance_context
283 end
conversation_sid() click to toggle source

@return [String] The unique ID of the Conversation for this User Conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
299 def conversation_sid
300   @properties['conversation_sid']
301 end
conversation_state() click to toggle source

@return [user_conversation.State] The current state of this User Conversation

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
335 def conversation_state
336   @properties['conversation_state']
337 end
created_by() click to toggle source

@return [String] Creator of this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
365 def created_by
366   @properties['created_by']
367 end
date_created() click to toggle source

@return [Time] The date that this conversation was created.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
353 def date_created
354   @properties['date_created']
355 end
date_updated() click to toggle source

@return [Time] The date that this conversation was last updated.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
359 def date_updated
360   @properties['date_updated']
361 end
delete() click to toggle source

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

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
413 def delete
414   context.delete
415 end
fetch() click to toggle source

Fetch the UserConversationInstance @return [UserConversationInstance] Fetched UserConversationInstance

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
420 def fetch
421   context.fetch
422 end
friendly_name() click to toggle source

@return [String] The human-readable name of this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
329 def friendly_name
330   @properties['friendly_name']
331 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
433 def inspect
434   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
435   "<Twilio.Conversations.V1.UserConversationInstance #{values}>"
436 end
last_read_message_index() click to toggle source

@return [String] The index of the last read Message .

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
311 def last_read_message_index
312   @properties['last_read_message_index']
313 end
notification_level() click to toggle source

@return [user_conversation.NotificationLevel] The Notification Level of this User Conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
371 def notification_level
372   @properties['notification_level']
373 end
participant_sid() click to toggle source

@return [String] Participant Sid.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
317 def participant_sid
318   @properties['participant_sid']
319 end
timers() click to toggle source

@return [Hash] Timer date values for this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
341 def timers
342   @properties['timers']
343 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
426 def to_s
427   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
428   "<Twilio.Conversations.V1.UserConversationInstance #{values}>"
429 end
unique_name() click to toggle source

@return [String] An application-defined string that uniquely identifies the Conversation resource.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
377 def unique_name
378   @properties['unique_name']
379 end
unread_messages_count() click to toggle source

@return [String] The number of unread Messages in the Conversation.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
305 def unread_messages_count
306   @properties['unread_messages_count']
307 end
update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) click to toggle source

Update the UserConversationInstance @param [user_conversation.NotificationLevel] notification_level The Notification

Level of this User Conversation. One of `default` or `muted`.

@param [Time] last_read_timestamp The date of the last message read in

conversation by the user, given in ISO 8601 format.

@param [String] last_read_message_index The index of the last Message in the

Conversation that the Participant has read.

@return [UserConversationInstance] Updated UserConversationInstance

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
402 def update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset)
403   context.update(
404       notification_level: notification_level,
405       last_read_timestamp: last_read_timestamp,
406       last_read_message_index: last_read_message_index,
407   )
408 end
url() click to toggle source

@return [String] The url

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
383 def url
384   @properties['url']
385 end
user_sid() click to toggle source

@return [String] The unique ID for the User.

    # File lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
323 def user_sid
324   @properties['user_sid']
325 end