class Twilio::REST::Api::V2010::AccountContext::CallContext
Public Class Methods
Initialize the CallContext
@param [Version] version Version
that contains the resource @param [String] account_sid The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created the Call resource(s) to fetch.
@param [String] sid The SID of the Call resource to fetch. @return [CallContext] CallContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 432 def initialize(version, account_sid, sid) 433 super(version) 434 435 # Path Solution 436 @solution = {account_sid: account_sid, sid: sid, } 437 @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:sid]}.json" 438 439 # Dependents 440 @recordings = nil 441 @notifications = nil 442 @feedback = nil 443 @events = nil 444 @payments = nil 445 end
Public Instance Methods
Delete the CallInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 450 def delete 451 @version.delete('DELETE', @uri) 452 end
Access the events @return [EventList] @return [EventContext]
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 571 def events 572 unless @events 573 @events = EventList.new(@version, account_sid: @solution[:account_sid], call_sid: @solution[:sid], ) 574 end 575 576 @events 577 end
Access the feedback @return [FeedbackList] @return [FeedbackContext]
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 563 def feedback 564 FeedbackContext.new(@version, @solution[:account_sid], @solution[:sid], ) 565 end
Fetch the CallInstance
@return [CallInstance] Fetched CallInstance
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 457 def fetch 458 payload = @version.fetch('GET', @uri) 459 460 CallInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) 461 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 610 def inspect 611 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 612 "#<Twilio.Api.V2010.CallContext #{context}>" 613 end
Access the notifications @return [NotificationList] @return [NotificationContext] if sid was passed.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 541 def notifications(sid=:unset) 542 raise ArgumentError, 'sid cannot be nil' if sid.nil? 543 544 if sid != :unset 545 return NotificationContext.new(@version, @solution[:account_sid], @solution[:sid], sid, ) 546 end 547 548 unless @notifications 549 @notifications = NotificationList.new( 550 @version, 551 account_sid: @solution[:account_sid], 552 call_sid: @solution[:sid], 553 ) 554 end 555 556 @notifications 557 end
Access the payments @return [PaymentList] @return [PaymentContext] if sid was passed.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 583 def payments(sid=:unset) 584 raise ArgumentError, 'sid cannot be nil' if sid.nil? 585 586 if sid != :unset 587 return PaymentContext.new(@version, @solution[:account_sid], @solution[:sid], sid, ) 588 end 589 590 unless @payments 591 @payments = PaymentList.new( 592 @version, 593 account_sid: @solution[:account_sid], 594 call_sid: @solution[:sid], 595 ) 596 end 597 598 @payments 599 end
Access the recordings @return [RecordingList] @return [RecordingContext] if sid was passed.
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 519 def recordings(sid=:unset) 520 raise ArgumentError, 'sid cannot be nil' if sid.nil? 521 522 if sid != :unset 523 return RecordingContext.new(@version, @solution[:account_sid], @solution[:sid], sid, ) 524 end 525 526 unless @recordings 527 @recordings = RecordingList.new( 528 @version, 529 account_sid: @solution[:account_sid], 530 call_sid: @solution[:sid], 531 ) 532 end 533 534 @recordings 535 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 603 def to_s 604 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 605 "#<Twilio.Api.V2010.CallContext #{context}>" 606 end
Update the CallInstance
@param [String] url The absolute URL that returns the TwiML
instructions for the
call. We will call this URL using the `method` when the call connects. For more information, see the {Url Parameter}[https://www.twilio.com/docs/voice/make-calls#specify-a-url-parameter] section in {Making Calls}[https://www.twilio.com/docs/voice/make-calls].
@param [String] method The HTTP
method we should use when calling the `url`. Can
be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
@param [call.UpdateStatus] status The new status of the resource. Can be:
`canceled` or `completed`. Specifying `canceled` will attempt to hang up calls that are queued or ringing; however, it will not affect calls already in progress. Specifying `completed` will attempt to hang up a call even if it's already in progress.
@param [String] fallback_url The URL that we call using the `fallback_method` if
an error occurs when requesting or executing the TwiML at `url`. If an `application_sid` parameter is present, this parameter is ignored.
@param [String] fallback_method The HTTP
method that we should use to request
the `fallback_url`. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
@param [String] status_callback The URL we should call using the
`status_callback_method` to send status information to your application. If no `status_callback_event` is specified, we will send the `completed` status. If an `application_sid` parameter is present, this parameter is ignored. URLs must contain a valid hostname (underscores are not permitted).
@param [String] status_callback_method The HTTP
method we should use when
requesting the `status_callback` URL. Can be: `GET` or `POST` and the default is `POST`. If an `application_sid` parameter is present, this parameter is ignored.
@param [String] twiml TwiML
instructions for the call Twilio
will use without
fetching Twiml from url. Twiml and url parameters are mutually exclusive
@param [String] time_limit The maximum duration of the call in seconds.
Constraints depend on account and configuration.
@return [CallInstance] Updated CallInstance
# File lib/twilio-ruby/rest/api/v2010/account/call.rb 497 def update(url: :unset, method: :unset, status: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, twiml: :unset, time_limit: :unset) 498 data = Twilio::Values.of({ 499 'Url' => url, 500 'Method' => method, 501 'Status' => status, 502 'FallbackUrl' => fallback_url, 503 'FallbackMethod' => fallback_method, 504 'StatusCallback' => status_callback, 505 'StatusCallbackMethod' => status_callback_method, 506 'Twiml' => twiml, 507 'TimeLimit' => time_limit, 508 }) 509 510 payload = @version.update('POST', @uri, data: data) 511 512 CallInstance.new(@version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) 513 end