Class: Twilio::REST::Conversations::V1::ServiceContext::UserContext::UserConversationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::ServiceContext::UserContext::UserConversationInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this conversation.
-
#attributes ⇒ String
An optional string metadata field you can use to store any data you wish.
-
#chat_service_sid ⇒ String
The unique ID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
-
#context ⇒ UserConversationContext
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 User Conversation.
- #conversation_state ⇒ State
-
#created_by ⇒ String
Identity of the creator of this Conversation.
-
#date_created ⇒ Time
The date that this conversation was created, given in ISO 8601 format.
-
#date_updated ⇒ Time
The date that this conversation was last updated, given in ISO 8601 format.
-
#delete ⇒ Boolean
Delete the UserConversationInstance.
-
#fetch ⇒ UserConversationInstance
Fetch the UserConversationInstance.
-
#friendly_name ⇒ String
The human-readable name of this conversation, limited to 256 characters.
-
#initialize(version, payload, chat_service_sid: nil, user_sid: nil, conversation_sid: nil) ⇒ UserConversationInstance
constructor
Initialize the UserConversationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#last_read_message_index ⇒ String
The index of the last Message in the Conversation that the Participant has read.
-
#links ⇒ Hash
Contains absolute URLs to access the [participant](www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](www.twilio.com/docs/conversations/api/conversation-resource) of this conversation.
- #notification_level ⇒ NotificationLevel
-
#participant_sid ⇒ String
The unique ID of the [participant](www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to.
-
#timers ⇒ Hash
Timer date values representing state update for this conversation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#unique_name ⇒ String
An application-defined string that uniquely identifies the Conversation resource.
-
#unread_messages_count ⇒ String
The number of unread Messages in the Conversation for the Participant.
-
#update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) ⇒ UserConversationInstance
Update the UserConversationInstance.
- #url ⇒ String
-
#user_sid ⇒ String
The unique string that identifies the [User resource](www.twilio.com/docs/conversations/api/user-resource).
Constructor Details
#initialize(version, payload, chat_service_sid: nil, user_sid: nil, conversation_sid: nil) ⇒ UserConversationInstance
Initialize the UserConversationInstance
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 490 def initialize(version, payload , chat_service_sid: nil, user_sid: nil, conversation_sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'chat_service_sid' => payload['chat_service_sid'], 'conversation_sid' => payload['conversation_sid'], 'unread_messages_count' => payload['unread_messages_count'] == nil ? payload['unread_messages_count'] : payload['unread_messages_count'].to_i, 'last_read_message_index' => payload['last_read_message_index'] == nil ? payload['last_read_message_index'] : payload['last_read_message_index'].to_i, 'participant_sid' => payload['participant_sid'], 'user_sid' => payload['user_sid'], 'friendly_name' => payload['friendly_name'], 'conversation_state' => payload['conversation_state'], 'timers' => payload['timers'], 'attributes' => payload['attributes'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'created_by' => payload['created_by'], 'notification_level' => payload['notification_level'], 'unique_name' => payload['unique_name'], 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = { 'chat_service_sid' => chat_service_sid || @properties['chat_service_sid'] ,'user_sid' => user_sid || @properties['user_sid'] ,'conversation_sid' => conversation_sid || @properties['conversation_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 conversation.
534 535 536 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 534 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.
594 595 596 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 594 def attributes @properties['attributes'] end |
#chat_service_sid ⇒ String
Returns The unique ID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
540 541 542 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 540 def chat_service_sid @properties['chat_service_sid'] end |
#context ⇒ UserConversationContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
525 526 527 528 529 530 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 525 def context unless @instance_context @instance_context = UserConversationContext.new(@version , @params['chat_service_sid'], @params['user_sid'], @params['conversation_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 User Conversation.
546 547 548 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 546 def conversation_sid @properties['conversation_sid'] end |
#conversation_state ⇒ State
582 583 584 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 582 def conversation_state @properties['conversation_state'] end |
#created_by ⇒ String
Returns Identity of the creator of this Conversation.
612 613 614 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 612 def created_by @properties['created_by'] end |
#date_created ⇒ Time
Returns The date that this conversation was created, given in ISO 8601 format.
600 601 602 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 600 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date that this conversation was last updated, given in ISO 8601 format.
606 607 608 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 606 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the UserConversationInstance
643 644 645 646 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 643 def delete context.delete end |
#fetch ⇒ UserConversationInstance
Fetch the UserConversationInstance
651 652 653 654 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 651 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The human-readable name of this conversation, limited to 256 characters. Optional.
576 577 578 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 576 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
684 685 686 687 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 684 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.UserConversationInstance #{values}>" end |
#last_read_message_index ⇒ String
Returns The index of the last Message in the Conversation that the Participant has read.
558 559 560 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 558 def @properties['last_read_message_index'] end |
#links ⇒ Hash
Returns Contains absolute URLs to access the [participant](www.twilio.com/docs/conversations/api/conversation-participant-resource) and [conversation](www.twilio.com/docs/conversations/api/conversation-resource) of this conversation.
636 637 638 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 636 def links @properties['links'] end |
#notification_level ⇒ NotificationLevel
618 619 620 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 618 def notification_level @properties['notification_level'] end |
#participant_sid ⇒ String
Returns The unique ID of the [participant](www.twilio.com/docs/conversations/api/conversation-participant-resource) the user conversation belongs to.
564 565 566 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 564 def participant_sid @properties['participant_sid'] end |
#timers ⇒ Hash
Returns Timer date values representing state update for this conversation.
588 589 590 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 588 def timers @properties['timers'] end |
#to_s ⇒ Object
Provide a user friendly representation
677 678 679 680 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 677 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.UserConversationInstance #{values}>" end |
#unique_name ⇒ String
Returns An application-defined string that uniquely identifies the Conversation resource. It can be used to address the resource in place of the resource’s conversation_sid in the URL.
624 625 626 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 624 def unique_name @properties['unique_name'] end |
#unread_messages_count ⇒ String
Returns The number of unread Messages in the Conversation for the Participant.
552 553 554 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 552 def @properties['unread_messages_count'] end |
#update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) ⇒ UserConversationInstance
Update the UserConversationInstance
662 663 664 665 666 667 668 669 670 671 672 673 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 662 def update( notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset ) context.update( notification_level: notification_level, last_read_timestamp: , last_read_message_index: , ) end |
#url ⇒ String
630 631 632 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 630 def url @properties['url'] end |
#user_sid ⇒ String
Returns The unique string that identifies the [User resource](www.twilio.com/docs/conversations/api/user-resource).
570 571 572 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb', line 570 def user_sid @properties['user_sid'] end |