class Twilio::REST::Conversations::V1::ConversationContext::ParticipantContext
Public Class Methods
Initialize the ParticipantContext
@param [Version] version Version
that contains the resource @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
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 205 def initialize(version, conversation_sid, sid) 206 super(version) 207 208 # Path Solution 209 @solution = {conversation_sid: conversation_sid, sid: sid, } 210 @uri = "/Conversations/#{@solution[:conversation_sid]}/Participants/#{@solution[:sid]}" 211 end
Public Instance Methods
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/conversation/participant.rb 271 def delete(x_twilio_webhook_enabled: :unset) 272 headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) 273 274 @version.delete('DELETE', @uri, headers: headers) 275 end
Fetch the ParticipantInstance
@return [ParticipantInstance] Fetched ParticipantInstance
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 280 def fetch 281 payload = @version.fetch('GET', @uri) 282 283 ParticipantInstance.new( 284 @version, 285 payload, 286 conversation_sid: @solution[:conversation_sid], 287 sid: @solution[:sid], 288 ) 289 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 300 def inspect 301 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 302 "#<Twilio.Conversations.V1.ParticipantContext #{context}>" 303 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 293 def to_s 294 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 295 "#<Twilio.Conversations.V1.ParticipantContext #{context}>" 296 end
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] 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] 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 Conversations SDK to communicate. Limited to 256 characters.
@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/conversation/participant.rb 242 def update(date_created: :unset, date_updated: :unset, attributes: :unset, role_sid: :unset, messaging_binding_proxy_address: :unset, messaging_binding_projected_address: :unset, identity: :unset, last_read_message_index: :unset, last_read_timestamp: :unset, x_twilio_webhook_enabled: :unset) 243 data = Twilio::Values.of({ 244 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created), 245 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated), 246 'Attributes' => attributes, 247 'RoleSid' => role_sid, 248 'MessagingBinding.ProxyAddress' => messaging_binding_proxy_address, 249 'MessagingBinding.ProjectedAddress' => messaging_binding_projected_address, 250 'Identity' => identity, 251 'LastReadMessageIndex' => last_read_message_index, 252 'LastReadTimestamp' => last_read_timestamp, 253 }) 254 headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) 255 256 payload = @version.update('POST', @uri, data: data, headers: headers) 257 258 ParticipantInstance.new( 259 @version, 260 payload, 261 conversation_sid: @solution[:conversation_sid], 262 sid: @solution[:sid], 263 ) 264 end