class Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::ParticipantContext

Public Class Methods

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

Initialize the ParticipantContext @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
Participant resource is associated with.

@param [String] conversation_sid The unique ID of the

{Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
for this participant.

@param [String] sid A 34 character string that uniquely identifies this

resource.

@return [ParticipantContext] ParticipantContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
222 def initialize(version, chat_service_sid, conversation_sid, sid)
223   super(version)
224 
225   # Path Solution
226   @solution = {chat_service_sid: chat_service_sid, conversation_sid: conversation_sid, sid: sid, }
227   @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Participants/#{@solution[:sid]}"
228 end

Public Instance Methods

delete(x_twilio_webhook_enabled: :unset) click to toggle source

Delete the ParticipantInstance @param [participant.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

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

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
289 def delete(x_twilio_webhook_enabled: :unset)
290   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
291 
292    @version.delete('DELETE', @uri, headers: headers)
293 end
fetch() click to toggle source

Fetch the ParticipantInstance @return [ParticipantInstance] Fetched ParticipantInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
298 def fetch
299   payload = @version.fetch('GET', @uri)
300 
301   ParticipantInstance.new(
302       @version,
303       payload,
304       chat_service_sid: @solution[:chat_service_sid],
305       conversation_sid: @solution[:conversation_sid],
306       sid: @solution[:sid],
307   )
308 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
319 def inspect
320   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
321   "#<Twilio.Conversations.V1.ParticipantContext #{context}>"
322 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
312 def to_s
313   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
314   "#<Twilio.Conversations.V1.ParticipantContext #{context}>"
315 end
update(date_created: :unset, date_updated: :unset, identity: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the ParticipantInstance @param [Time] date_created The date that this resource was created. @param [Time] date_updated The date that this resource was last updated. @param [String] identity A unique string identifier for the conversation

participant as {Conversation
User}[https://www.twilio.com/docs/conversations/api/user-resource]. This
parameter is non-null if (and only if) the participant is using the Conversation
SDK to communicate. Limited to 256 characters.

@param [String] attributes An optional string metadata field you can use to

store any data you wish. The string value must contain structurally valid JSON
if specified.  **Note** that if the attributes are not set "{}" will be
returned.

@param [String] role_sid The SID of a conversation-level

{Role}[https://www.twilio.com/docs/conversations/api/role-resource] to assign to
the participant.

@param [String] messaging_binding_proxy_address The address of the Twilio phone

number that the participant is in contact with. 'null' value will remove it.

@param [String] messaging_binding_projected_address The address of the Twilio

phone number that is used in Group MMS. 'null' value will remove it.

@param [String] last_read_message_index Index of last “read” message in the

{Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
for the Participant.

@param [String] last_read_timestamp Timestamp of last “read” message in the

{Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
for the Participant.

@param [participant.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [ParticipantInstance] Updated ParticipantInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
259 def update(date_created: :unset, date_updated: :unset, identity: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset)
260   data = Twilio::Values.of({
261       'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
262       'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
263       'Identity' => identity,
264       'Attributes' => attributes,
265       'RoleSid' => role_sid,
266       'MessagingBinding.ProxyAddress' => messaging_binding_proxy_address,
267       'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address,
268       'LastReadMessageIndex' => last_read_message_index,
269       'LastReadTimestamp' => last_read_timestamp,
270   })
271   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
272 
273   payload = @version.update('POST', @uri, data: data, headers: headers)
274 
275   ParticipantInstance.new(
276       @version,
277       payload,
278       chat_service_sid: @solution[:chat_service_sid],
279       conversation_sid: @solution[:conversation_sid],
280       sid: @solution[:sid],
281   )
282 end