Class: Twilio::REST::Conversations::V1::UserContext::UserConversationContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::UserContext::UserConversationContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the UserConversationInstance.
-
#fetch ⇒ UserConversationInstance
Fetch the UserConversationInstance.
-
#initialize(version, user_sid, conversation_sid) ⇒ UserConversationContext
constructor
Initialize the UserConversationContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) ⇒ UserConversationInstance
Update the UserConversationInstance.
Constructor Details
#initialize(version, user_sid, conversation_sid) ⇒ UserConversationContext
Initialize the UserConversationContext
139 140 141 142 143 144 145 146 147 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 139 def initialize(version, user_sid, conversation_sid) super(version) # Path Solution @solution = { user_sid: user_sid, conversation_sid: conversation_sid, } @uri = "/Users/#{@solution[:user_sid]}/Conversations/#{@solution[:conversation_sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the UserConversationInstance
151 152 153 154 155 156 157 158 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 151 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ UserConversationInstance
Fetch the UserConversationInstance
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 163 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) UserConversationInstance.new( @version, payload, user_sid: @solution[:user_sid], conversation_sid: @solution[:conversation_sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
223 224 225 226 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 223 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.UserConversationContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
216 217 218 219 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 216 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.UserConversationContext #{context}>" end |
#update(notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset) ⇒ UserConversationInstance
Update the UserConversationInstance
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb', line 186 def update( notification_level: :unset, last_read_timestamp: :unset, last_read_message_index: :unset ) data = Twilio::Values.of({ 'NotificationLevel' => notification_level, 'LastReadTimestamp' => Twilio.serialize_iso8601_datetime(), 'LastReadMessageIndex' => , }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) UserConversationInstance.new( @version, payload, user_sid: @solution[:user_sid], conversation_sid: @solution[:conversation_sid], ) end |