class Twilio::REST::Conversations::V1::ServiceContext::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] 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 [ParticipantInstance] ParticipantInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 339 def initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil) 340 super(version) 341 342 # Marshaled Properties 343 @properties = { 344 'account_sid' => payload['account_sid'], 345 'chat_service_sid' => payload['chat_service_sid'], 346 'conversation_sid' => payload['conversation_sid'], 347 'sid' => payload['sid'], 348 'identity' => payload['identity'], 349 'attributes' => payload['attributes'], 350 'messaging_binding' => payload['messaging_binding'], 351 'role_sid' => payload['role_sid'], 352 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 353 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 354 'url' => payload['url'], 355 'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i, 356 'last_read_timestamp' => payload['last_read_timestamp'], 357 } 358 359 # Context 360 @instance_context = nil 361 @params = { 362 'chat_service_sid' => chat_service_sid, 363 'conversation_sid' => conversation_sid, 364 'sid' => sid || @properties['sid'], 365 } 366 end
Public Instance Methods
@return [String] The unique ID of the Account responsible for this participant.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 386 def account_sid 387 @properties['account_sid'] 388 end
@return [String] An optional string metadata field you can use to store any data you wish.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 416 def attributes 417 @properties['attributes'] 418 end
@return [String] The SID of the Conversation Service that the resource is associated with.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 392 def chat_service_sid 393 @properties['chat_service_sid'] 394 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/service/conversation/participant.rb 372 def context 373 unless @instance_context 374 @instance_context = ParticipantContext.new( 375 @version, 376 @params['chat_service_sid'], 377 @params['conversation_sid'], 378 @params['sid'], 379 ) 380 end 381 @instance_context 382 end
@return [String] The unique ID of the Conversation for this participant.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 398 def conversation_sid 399 @properties['conversation_sid'] 400 end
@return [Time] The date that this resource was created.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 434 def date_created 435 @properties['date_created'] 436 end
@return [Time] The date that this resource was last updated.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 440 def date_updated 441 @properties['date_updated'] 442 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/service/conversation/participant.rb 511 def delete(x_twilio_webhook_enabled: :unset) 512 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 513 end
Fetch the ParticipantInstance
@return [ParticipantInstance] Fetched ParticipantInstance
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 518 def fetch 519 context.fetch 520 end
@return [String] A unique string identifier for the conversation participant as Conversation User.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 410 def identity 411 @properties['identity'] 412 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 531 def inspect 532 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 533 "<Twilio.Conversations.V1.ParticipantInstance #{values}>" 534 end
@return [String] Index of last “read” message in the Conversation for the Participant.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 452 def last_read_message_index 453 @properties['last_read_message_index'] 454 end
@return [String] Timestamp of last “read” message in the Conversation for the Participant.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 458 def last_read_timestamp 459 @properties['last_read_timestamp'] 460 end
@return [Hash] Information about how this participant exchanges messages with the conversation.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 422 def messaging_binding 423 @properties['messaging_binding'] 424 end
@return [String] The SID of a conversation-level Role to assign to the participant
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 428 def role_sid 429 @properties['role_sid'] 430 end
@return [String] A 34 character string that uniquely identifies this resource.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 404 def sid 405 @properties['sid'] 406 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 524 def to_s 525 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 526 "<Twilio.Conversations.V1.ParticipantInstance #{values}>" 527 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] 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 491 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) 492 context.update( 493 date_created: date_created, 494 date_updated: date_updated, 495 identity: identity, 496 attributes: attributes, 497 role_sid: role_sid, 498 messaging_binding_proxy_address: messaging_binding_proxy_address, 499 messaging_binding_projected_address: messaging_binding_projected_address, 500 last_read_message_index: last_read_message_index, 501 last_read_timestamp: last_read_timestamp, 502 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 503 ) 504 end
@return [String] An absolute URL for this participant.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb 446 def url 447 @properties['url'] 448 end