class Twilio::REST::Conversations::V1::ServiceContext::UserContext::UserConversationContext

Public Class Methods

new(version, chat_service_sid, user_sid, conversation_sid) click to toggle source

Initialize the UserConversationContext @param [Version] version Version that contains the resource @param [String] chat_service_sid The SID of the {Conversation

Service}[https://www.twilio.com/docs/conversations/api/service-resource] the
Conversation resource is associated with.

@param [String] user_sid The unique SID identifier of the {User

resource}[https://www.twilio.com/docs/conversations/api/user-resource]. This
value can be either the `sid` or the `identity` of the 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 [UserConversationContext] UserConversationContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb
168 def initialize(version, chat_service_sid, user_sid, conversation_sid)
169   super(version)
170 
171   # Path Solution
172   @solution = {
173       chat_service_sid: chat_service_sid,
174       user_sid: user_sid,
175       conversation_sid: conversation_sid,
176   }
177   @uri = "/Services/#{@solution[:chat_service_sid]}/Users/#{@solution[:user_sid]}/Conversations/#{@solution[:conversation_sid]}"
178 end

Public Instance Methods

delete() click to toggle source

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

    # File lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb
210 def delete
211    @version.delete('DELETE', @uri)
212 end
fetch() click to toggle source

Fetch the UserConversationInstance @return [UserConversationInstance] Fetched UserConversationInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb
217 def fetch
218   payload = @version.fetch('GET', @uri)
219 
220   UserConversationInstance.new(
221       @version,
222       payload,
223       chat_service_sid: @solution[:chat_service_sid],
224       user_sid: @solution[:user_sid],
225       conversation_sid: @solution[:conversation_sid],
226   )
227 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb
238 def inspect
239   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
240   "#<Twilio.Conversations.V1.UserConversationContext #{context}>"
241 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb
231 def to_s
232   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
233   "#<Twilio.Conversations.V1.UserConversationContext #{context}>"
234 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/service/user/user_conversation.rb
189 def update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset)
190   data = Twilio::Values.of({
191       'NotificationLevel' => notification_level,
192       'LastReadTimestamp' => Twilio.serialize_iso8601_datetime(last_read_timestamp),
193       'LastReadMessageIndex' => last_read_message_index,
194   })
195 
196   payload = @version.update('POST', @uri, data: data)
197 
198   UserConversationInstance.new(
199       @version,
200       payload,
201       chat_service_sid: @solution[:chat_service_sid],
202       user_sid: @solution[:user_sid],
203       conversation_sid: @solution[:conversation_sid],
204   )
205 end