Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::ParticipantInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::ParticipantInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this participant.
-
#attributes ⇒ String
An optional string metadata field you can use to store any data you wish.
-
#chat_service_sid ⇒ String
The SID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with.
-
#context ⇒ ParticipantContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#conversation_sid ⇒ String
The unique ID of the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for this participant.
-
#date_created ⇒ Time
The date on which this resource was created.
-
#date_updated ⇒ Time
The date on which this resource was last updated.
-
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ParticipantInstance.
-
#fetch ⇒ ParticipantInstance
Fetch the ParticipantInstance.
-
#identity ⇒ String
A unique string identifier for the conversation participant as [Conversation User](www.twilio.com/docs/conversations/api/user-resource).
-
#initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil) ⇒ ParticipantInstance
constructor
Initialize the ParticipantInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#last_read_message_index ⇒ String
Index of last “read” message in the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.
-
#last_read_timestamp ⇒ String
Timestamp of last “read” message in the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.
-
#messaging_binding ⇒ Hash
Information about how this participant exchanges messages with the conversation.
-
#role_sid ⇒ String
The SID of a conversation-level [Role](www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.
-
#sid ⇒ String
A 34 character string that uniquely identifies this resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#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) ⇒ ParticipantInstance
Update the ParticipantInstance.
-
#url ⇒ String
An absolute API resource URL for this participant.
Constructor Details
#initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil) ⇒ ParticipantInstance
Initialize the ParticipantInstance
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 321 def initialize(version, payload , chat_service_sid: nil, conversation_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'chat_service_sid' => payload['chat_service_sid'], 'conversation_sid' => payload['conversation_sid'], 'sid' => payload['sid'], 'identity' => payload['identity'], 'attributes' => payload['attributes'], 'messaging_binding' => payload['messaging_binding'], 'role_sid' => payload['role_sid'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'url' => payload['url'], 'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i, 'last_read_timestamp' => payload['last_read_timestamp'], } # Context @instance_context = nil @params = { 'chat_service_sid' => chat_service_sid || @properties['chat_service_sid'] ,'conversation_sid' => conversation_sid || @properties['conversation_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this participant.
359 360 361 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 359 def account_sid @properties['account_sid'] end |
#attributes ⇒ String
Returns 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.
389 390 391 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 389 def attributes @properties['attributes'] end |
#chat_service_sid ⇒ String
Returns The SID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) the Participant resource is associated with.
365 366 367 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 365 def chat_service_sid @properties['chat_service_sid'] end |
#context ⇒ ParticipantContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
350 351 352 353 354 355 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 350 def context unless @instance_context @instance_context = ParticipantContext.new(@version , @params['chat_service_sid'], @params['conversation_sid'], @params['sid']) end @instance_context end |
#conversation_sid ⇒ String
Returns The unique ID of the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for this participant.
371 372 373 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 371 def conversation_sid @properties['conversation_sid'] end |
#date_created ⇒ Time
Returns The date on which this resource was created.
407 408 409 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 407 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date on which this resource was last updated.
413 414 415 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 413 def date_updated @properties['date_updated'] end |
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ParticipantInstance
439 440 441 442 443 444 445 446 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 439 def delete( x_twilio_webhook_enabled: :unset ) context.delete( x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) end |
#fetch ⇒ ParticipantInstance
Fetch the ParticipantInstance
451 452 453 454 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 451 def fetch context.fetch end |
#identity ⇒ String
Returns A unique string identifier for the conversation participant as [Conversation User](www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the [Conversation SDK](www.twilio.com/docs/conversations/sdk-overview) to communicate. Limited to 256 characters.
383 384 385 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 383 def identity @properties['identity'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
505 506 507 508 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 505 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ParticipantInstance #{values}>" end |
#last_read_message_index ⇒ String
Returns Index of last “read” message in the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.
425 426 427 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 425 def @properties['last_read_message_index'] end |
#last_read_timestamp ⇒ String
Returns Timestamp of last “read” message in the [Conversation](www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.
431 432 433 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 431 def @properties['last_read_timestamp'] end |
#messaging_binding ⇒ Hash
Returns Information about how this participant exchanges messages with the conversation. A JSON parameter consisting of type and address fields of the participant.
395 396 397 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 395 def messaging_binding @properties['messaging_binding'] end |
#role_sid ⇒ String
Returns The SID of a conversation-level [Role](www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.
401 402 403 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 401 def role_sid @properties['role_sid'] end |
#sid ⇒ String
Returns A 34 character string that uniquely identifies this resource.
377 378 379 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 377 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
498 499 500 501 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 498 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ParticipantInstance #{values}>" 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) ⇒ ParticipantInstance
Update the ParticipantInstance
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 469 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 ) context.update( date_created: date_created, date_updated: date_updated, identity: identity, attributes: attributes, role_sid: role_sid, messaging_binding_proxy_address: messaging_binding_proxy_address, messaging_binding_projected_address: messaging_binding_projected_address, last_read_message_index: , last_read_timestamp: , x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) end |
#url ⇒ String
Returns An absolute API resource URL for this participant.
419 420 421 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/participant.rb', line 419 def url @properties['url'] end |