Class: Twilio::REST::Conversations::V1::ConversationContext::MessageContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ConversationContext::MessageContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/conversation/message.rb
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Instance Method Summary collapse
-
#delete ⇒ Boolean
Deletes the MessageInstance.
-
#fetch ⇒ MessageInstance
Fetch a MessageInstance.
-
#initialize(version, conversation_sid, sid) ⇒ MessageContext
constructor
Initialize the MessageContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset) ⇒ MessageInstance
Update the MessageInstance.
Constructor Details
#initialize(version, conversation_sid, sid) ⇒ MessageContext
Initialize the MessageContext
194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 194 def initialize(version, conversation_sid, sid) super(version) # Path Solution @solution = {conversation_sid: conversation_sid, sid: sid, } @uri = "/Conversations/#{@solution[:conversation_sid]}/Messages/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Deletes the MessageInstance
241 242 243 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 241 def delete @version.delete('delete', @uri) end |
#fetch ⇒ MessageInstance
Fetch a MessageInstance
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 248 def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) MessageInstance.new( @version, payload, conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
274 275 276 277 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 274 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.MessageContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
267 268 269 270 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 267 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.MessageContext #{context}>" end |
#update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset) ⇒ MessageInstance
Update the MessageInstance
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 215 def update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset) data = Twilio::Values.of({ 'Author' => , 'Body' => body, 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created), 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated), 'Attributes' => attributes, }) payload = @version.update( 'POST', @uri, data: data, ) MessageInstance.new( @version, payload, conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |