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, DeliveryReceiptInstanceMetadata, DeliveryReceiptList, DeliveryReceiptListResponse, DeliveryReceiptPage, DeliveryReceiptPageMetadata
Instance Method Summary collapse
-
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the MessageInstance.
-
#delete_with_metadata(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the MessageInstanceMetadata.
-
#delivery_receipts(sid = :unset) ⇒ DeliveryReceiptList, DeliveryReceiptContext
Access the delivery_receipts.
-
#fetch ⇒ MessageInstance
Fetch the MessageInstance.
-
#fetch_with_metadata ⇒ MessageInstance
Fetch the MessageInstanceMetadata.
-
#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.
-
#update_with_metadata(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, subject: :unset, x_twilio_webhook_enabled: :unset) ⇒ MessageInstance
Update the MessageInstanceMetadata.
Constructor Details
#initialize(version, chat_service_sid, conversation_sid, sid) ⇒ MessageContext
Initialize the MessageContext
292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 292 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
307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 307 def delete( x_twilio_webhook_enabled: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the MessageInstanceMetadata
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 323 def ( x_twilio_webhook_enabled: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) response = @version.('DELETE', @uri, headers: headers) = MessageInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) MessageInstanceMetadata.new(@version, , response.headers, response.status_code) end |
#delivery_receipts(sid = :unset) ⇒ DeliveryReceiptList, DeliveryReceiptContext
Access the delivery_receipts
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 489 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
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 344 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) MessageInstance.new( @version, payload, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ MessageInstance
Fetch the MessageInstanceMetadata
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 365 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) = MessageInstance.new( @version, response.body, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) MessageInstanceMetadata.new( @version, , response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
514 515 516 517 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 514 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.MessageContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
507 508 509 510 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 507 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
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 399 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({'Content-Type' => 'application/x-www-form-urlencoded', '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 |
#update_with_metadata(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, subject: :unset, x_twilio_webhook_enabled: :unset) ⇒ MessageInstance
Update the MessageInstanceMetadata
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb', line 444 def ( 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({'Content-Type' => 'application/x-www-form-urlencoded', 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) response = @version.('POST', @uri, data: data, headers: headers) = MessageInstance.new( @version, response.body, chat_service_sid: @solution[:chat_service_sid], conversation_sid: @solution[:conversation_sid], sid: @solution[:sid], ) MessageInstanceMetadata.new( @version, , response.headers, response.status_code ) end |