Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::MessageContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::MessageContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb,
lib/twilio-ruby/rest/conversations/v1/service/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, chat_service_sid, 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, subject: :unset, x_twilio_webhook_enabled: :unset) ⇒ MessageInstance
Update the MessageInstance.
Constructor Details
#initialize(version, chat_service_sid, conversation_sid, sid) ⇒ MessageContext
Initialize the MessageContext
191 192 193 194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 191 def initialize(version, chat_service_sid, conversation_sid, sid) super(version) # Path Solution @solution = { chat_service_sid: chat_service_sid, conversation_sid: conversation_sid, sid: sid, } @uri = "/Services/#{@solution[:chat_service_sid]}/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
205 206 207 208 209 210 211 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 205 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
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 272 def delivery_receipts(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return DeliveryReceiptContext.new(@version, @solution[:chat_service_sid], @solution[:conversation_sid], @solution[:sid],sid ) end unless @delivery_receipts @delivery_receipts = DeliveryReceiptList.new( @version, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], message_sid: @solution[:sid], ) end @delivery_receipts end |
#fetch ⇒ MessageInstance
Fetch the MessageInstance
216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 216 def fetch payload = @version.fetch('GET', @uri) MessageInstance.new( @version, payload, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
297 298 299 300 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 297 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.MessageContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
290 291 292 293 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 290 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, subject: :unset, x_twilio_webhook_enabled: :unset) ⇒ MessageInstance
Update the MessageInstance
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 238 def update( author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, subject: :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, 'Subject' => subject, }) 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, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |