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
404 405 406 407 408 409 410 411 412 413 414 415 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 404 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
419 420 421 422 423 424 425 426 427 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 419 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
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 432 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
564 565 566 567 568 569 570 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 564 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
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 451 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
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 471 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
600 601 602 603 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 600 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.MessageContext #{context}>" end |
#media(sid = :unset) ⇒ MediaList, MediaContext
Access the media
575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 575 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
593 594 595 596 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 593 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
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 499 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
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
# File 'lib/twilio-ruby/rest/api/v2010/account/message.rb', line 529 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 |