lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.31.2 vs lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.31.3

- old
+ new

@@ -125,10 +125,13 @@ # milliseconds of silence after speech activity at which point the speech activity # is considered complete. Possible Values: 500-5000. Default: 1200. # @param [String] machine_detection_silence_timeout The number of milliseconds of # initial silence after which an `unknown` AnsweredBy result will be returned. # Possible Values: 2000-10000. Default: 5000. + # @param [String] byoc The SID of a BYOC (Bring Your Own Carrier) trunk to route + # this call with. Note that `byoc` is only meaningful when `to` is a phone number; + # it will otherwise be ignored. (Beta) # @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). @@ -136,11 +139,11 @@ # fetching Twiml from url parameter. If both `twiml` and `url` are provided then # `twiml` parameter will be ignored. # @param [String] application_sid The SID of the Application resource that will # handle the call, if the call will be handled by an application. # @return [CallInstance] Newly created CallInstance - def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, url: :unset, twiml: :unset, application_sid: :unset) + def create(to: nil, from: nil, method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_event: :unset, status_callback_method: :unset, send_digits: :unset, timeout: :unset, record: :unset, recording_channels: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, sip_auth_username: :unset, sip_auth_password: :unset, machine_detection: :unset, machine_detection_timeout: :unset, recording_status_callback_event: :unset, trim: :unset, caller_id: :unset, machine_detection_speech_threshold: :unset, machine_detection_speech_end_threshold: :unset, machine_detection_silence_timeout: :unset, byoc: :unset, url: :unset, twiml: :unset, application_sid: :unset) data = Twilio::Values.of({ 'To' => to, 'From' => from, 'Url' => url, 'Twiml' => twiml, @@ -165,10 +168,11 @@ 'Trim' => trim, 'CallerId' => caller_id, 'MachineDetectionSpeechThreshold' => machine_detection_speech_threshold, 'MachineDetectionSpeechEndThreshold' => machine_detection_speech_end_threshold, 'MachineDetectionSilenceTimeout' => machine_detection_silence_timeout, + 'Byoc' => byoc, }) payload = @version.create( 'POST', @uri, @@ -410,10 +414,11 @@ # Dependents @recordings = nil @notifications = nil @feedback = nil + @payments = nil end ## # Deletes the CallInstance # @return [Boolean] true if delete succeeds, false otherwise @@ -540,10 +545,32 @@ def feedback FeedbackContext.new(@version, @solution[:account_sid], @solution[:sid], ) end ## + # Access the payments + # @return [PaymentList] + # @return [PaymentContext] if sid was passed. + def payments(sid=:unset) + raise ArgumentError, 'sid cannot be nil' if sid.nil? + + if sid != :unset + return PaymentContext.new(@version, @solution[:account_sid], @solution[:sid], sid, ) + end + + unless @payments + @payments = PaymentList.new( + @version, + account_sid: @solution[:account_sid], + call_sid: @solution[:sid], + ) + end + + @payments + end + + ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Api.V2010.CallContext #{context}>" end @@ -840,9 +867,16 @@ ## # Access the feedback # @return [feedback] feedback def feedback context.feedback + end + + ## + # Access the payments + # @return [payments] payments + def payments + context.payments end ## # Provide a user friendly representation def to_s \ No newline at end of file