class Twilio::REST::Conversations::V1::ConversationContext::ParticipantInstance
Public Class Methods
Initialize the ParticipantInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@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 [ParticipantInstance] ParticipantInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 317 def initialize(version, payload, conversation_sid: nil, sid: nil) 318 super(version) 319 320 # Marshaled Properties 321 @properties = { 322 'account_sid' => payload['account_sid'], 323 'conversation_sid' => payload['conversation_sid'], 324 'sid' => payload['sid'], 325 'identity' => payload['identity'], 326 'attributes' => payload['attributes'], 327 'messaging_binding' => payload['messaging_binding'], 328 'role_sid' => payload['role_sid'], 329 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 330 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 331 'url' => payload['url'], 332 'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i, 333 'last_read_timestamp' => payload['last_read_timestamp'], 334 } 335 336 # Context 337 @instance_context = nil 338 @params = {'conversation_sid' => conversation_sid, 'sid' => sid || @properties['sid'], } 339 end
Public Instance Methods
@return [String] The unique ID of the Account responsible for this participant.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 354 def account_sid 355 @properties['account_sid'] 356 end
@return [String] An optional string metadata field you can use to store any data you wish.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 378 def attributes 379 @properties['attributes'] 380 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ParticipantContext] ParticipantContext
for this ParticipantInstance
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 345 def context 346 unless @instance_context 347 @instance_context = ParticipantContext.new(@version, @params['conversation_sid'], @params['sid'], ) 348 end 349 @instance_context 350 end
@return [String] The unique ID of the Conversation for this participant.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 360 def conversation_sid 361 @properties['conversation_sid'] 362 end
@return [Time] The date that this resource was created.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 396 def date_created 397 @properties['date_created'] 398 end
@return [Time] The date that this resource was last updated.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 402 def date_updated 403 @properties['date_updated'] 404 end
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 473 def delete(x_twilio_webhook_enabled: :unset) 474 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 475 end
Fetch the ParticipantInstance
@return [ParticipantInstance] Fetched ParticipantInstance
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 480 def fetch 481 context.fetch 482 end
@return [String] A unique string identifier for the conversation participant as Conversation User.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 372 def identity 373 @properties['identity'] 374 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 493 def inspect 494 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 495 "<Twilio.Conversations.V1.ParticipantInstance #{values}>" 496 end
@return [String] Index of last “read” message in the Conversation for the Participant.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 414 def last_read_message_index 415 @properties['last_read_message_index'] 416 end
@return [String] Timestamp of last “read” message in the Conversation for the Participant.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 420 def last_read_timestamp 421 @properties['last_read_timestamp'] 422 end
@return [Hash] Information about how this participant exchanges messages with the conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 384 def messaging_binding 385 @properties['messaging_binding'] 386 end
@return [String] The SID of a conversation-level Role to assign to the participant
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 390 def role_sid 391 @properties['role_sid'] 392 end
@return [String] A 34 character string that uniquely identifies this resource.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 366 def sid 367 @properties['sid'] 368 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 486 def to_s 487 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 488 "<Twilio.Conversations.V1.ParticipantInstance #{values}>" 489 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 453 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) 454 context.update( 455 date_created: date_created, 456 date_updated: date_updated, 457 attributes: attributes, 458 role_sid: role_sid, 459 messaging_binding_proxy_address: messaging_binding_proxy_address, 460 messaging_binding_projected_address: messaging_binding_projected_address, 461 identity: identity, 462 last_read_message_index: last_read_message_index, 463 last_read_timestamp: last_read_timestamp, 464 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 465 ) 466 end
@return [String] An absolute URL for this participant.
# File lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb 408 def url 409 @properties['url'] 410 end