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,
lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb
Defined Under Namespace
Classes: DeliveryReceiptContext, DeliveryReceiptInstance, DeliveryReceiptList, DeliveryReceiptPage
Instance Method Summary collapse
-
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the MessageInstance.
-
#delivery_receipts(sid = :unset) ⇒ DeliveryReceiptList, DeliveryReceiptContext
Access the delivery_receipts.
-
#fetch ⇒ MessageInstance
Fetch the 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, x_twilio_webhook_enabled: :unset) ⇒ MessageInstance
Update the MessageInstance.
Constructor Details
#initialize(version, conversation_sid, sid) ⇒ MessageContext
Initialize the MessageContext
185 186 187 188 189 190 191 192 193 194 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 185 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]}" # Dependents @delivery_receipts = nil end |
Instance Method Details
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the MessageInstance
199 200 201 202 203 204 205 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 199 def delete( x_twilio_webhook_enabled: :unset ) headers = Twilio::Values.of({ 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) @version.delete('DELETE', @uri, headers: headers) end |
#delivery_receipts(sid = :unset) ⇒ DeliveryReceiptList, DeliveryReceiptContext
Access the delivery_receipts
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 261 def delivery_receipts(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return DeliveryReceiptContext.new(@version, @solution[:conversation_sid], @solution[:sid],sid ) end unless @delivery_receipts @delivery_receipts = DeliveryReceiptList.new( @version, conversation_sid: @solution[:conversation_sid], message_sid: @solution[:sid], ) end @delivery_receipts end |
#fetch ⇒ MessageInstance
Fetch the MessageInstance
210 211 212 213 214 215 216 217 218 219 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 210 def fetch payload = @version.fetch('GET', @uri) MessageInstance.new( @version, payload, conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
286 287 288 289 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 286 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.MessageContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
279 280 281 282 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 279 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, x_twilio_webhook_enabled: :unset) ⇒ MessageInstance
Update the MessageInstance
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation/message.rb', line 230 def update( author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, x_twilio_webhook_enabled: :unset ) data = Twilio::Values.of({ 'Author' => , 'Body' => body, 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created), 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated), 'Attributes' => attributes, }) headers = Twilio::Values.of({ 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) payload = @version.update('POST', @uri, data: data, headers: headers) MessageInstance.new( @version, payload, conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |