Class: Twilio::REST::Api::V2010::AccountContext::MessageContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Api::V2010::AccountContext::MessageContext
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/message.rb,
lib/twilio-ruby/rest/api/v2010/account/message/media.rb,
lib/twilio-ruby/rest/api/v2010/account/message/feedback.rb
Defined Under Namespace
Classes: FeedbackInstance, FeedbackList, FeedbackPage, MediaContext, MediaInstance, MediaInstanceMetadata, MediaList, MediaListResponse, MediaPage, MediaPageMetadata
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the MessageInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the MessageInstanceMetadata.
-
#feedback ⇒ FeedbackList, FeedbackContext
Access the feedback.
-
#fetch ⇒ MessageInstance
Fetch the MessageInstance.
-
#fetch_with_metadata ⇒ MessageInstance
Fetch the MessageInstanceMetadata.
-
#initialize(version, account_sid, sid) ⇒ MessageContext
constructor
Initialize the MessageContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance.
-
#update_with_metadata(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstanceMetadata.
Constructor Details
#initialize(version, account_sid, sid) ⇒ MessageContext
Initialize the MessageContext
418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 418 def initialize(version, account_sid, sid) super(version) # Path Solution @solution = { account_sid: account_sid, sid: sid, } @uri = "/Accounts/#{@solution[:account_sid]}/Messages/#{@solution[:sid]}.json" # Dependents @feedback = nil @media = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the MessageInstance
433 434 435 436 437 438 439 440 441 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 433 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the MessageInstanceMetadata
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 446 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) 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 |
#feedback ⇒ FeedbackList, FeedbackContext
Access the feedback
578 579 580 581 582 583 584 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 578 def feedback unless @feedback @feedback = FeedbackList.new( @version, account_sid: @solution[:account_sid], message_sid: @solution[:sid], ) end @feedback end |
#fetch ⇒ MessageInstance
Fetch the MessageInstance
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 465 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) MessageInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ MessageInstance
Fetch the MessageInstanceMetadata
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 485 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @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 |
#inspect ⇒ Object
Provide a detailed, user friendly representation
614 615 616 617 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 614 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media
589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 589 def media(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return MediaContext.new(@version, @solution[:account_sid], @solution[:sid],sid ) end unless @media @media = MediaList.new( @version, account_sid: @solution[:account_sid], message_sid: @solution[:sid], ) end @media end |
#to_s ⇒ Object
Provide a user friendly representation
607 608 609 610 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 607 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#update(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstance
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 513 def update( body: :unset, status: :unset ) data = Twilio::Values.of({ 'Body' => body, 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) MessageInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) end |
#update_with_metadata(body: :unset, status: :unset) ⇒ MessageInstance
Update the MessageInstanceMetadata
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 543 def ( body: :unset, status: :unset ) data = Twilio::Values.of({ 'Body' => body, 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) = MessageInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) MessageInstanceMetadata.new( @version, , response.headers, response.status_code ) end |