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, FeedbackListResponse, FeedbackPage, FeedbackPageMetadata, 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
412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 412 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
427 428 429 430 431 432 433 434 435 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 427 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
440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 440 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
572 573 574 575 576 577 578 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 572 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
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 459 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
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 479 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
608 609 610 611 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 608 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 583 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
601 602 603 604 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 601 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
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 507 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
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 537 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 |