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
398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 398 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
413 414 415 416 417 418 419 420 421 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 413 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
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 426 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
558 559 560 561 562 563 564 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 558 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
445 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 445 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
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 465 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
594 595 596 597 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 594 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 569 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
587 588 589 590 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 587 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
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 493 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
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 523 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 |