lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.0.0.rc9 vs lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.0.0.rc10

- old
+ new

@@ -13,11 +13,10 @@ ## # Initialize the CallList # @param [Version] version Version that contains the resource # @param [String] account_sid The unique id of the Account responsible for # creating this Call - # @return [CallList] CallList def initialize(version, account_sid: nil) super(version) # Path Solution @@ -65,19 +64,20 @@ # the maximum is `999` seconds. Note, you could set this to a low value, such as # `15`, to hangup before reaching an answering machine or voicemail. # @param [Boolean] record Set this parameter to true to record the entirety of a # phone call. The RecordingUrl will be sent to the StatusCallback URL. Defaults to # false. + # @param [String] sip_auth_username The sip_auth_username + # @param [String] sip_auth_password The sip_auth_password # @param [String] url The fully qualified URL that should be consulted when the # call connects. Just like when you set a URL on a phone number for handling # inbound calls. # @param [String] application_sid The 34 character sid of the application Twilio # should use to handle this phone call. If this parameter is present, Twilio will # ignore all of the voice URLs passed and use the URLs set on the application. - # @return [CallInstance] Newly created CallInstance - def create(to: nil, from: nil, method: nil, fallback_url: nil, fallback_method: nil, status_callback: nil, status_callback_method: nil, send_digits: nil, if_machine: nil, timeout: nil, record: nil, url: nil, application_sid: nil) + def create(to: nil, from: nil, method: nil, fallback_url: nil, fallback_method: nil, status_callback: nil, status_callback_method: nil, send_digits: nil, if_machine: nil, timeout: nil, record: nil, sip_auth_username: nil, sip_auth_password: nil, url: nil, application_sid: nil) data = { 'To' => to, 'From' => from, 'Url' => url, 'ApplicationSid' => application_sid, @@ -88,10 +88,12 @@ 'StatusCallbackMethod' => status_callback_method, 'SendDigits' => send_digits, 'IfMachine' => if_machine, 'Timeout' => timeout, 'Record' => record, + 'SipAuthUsername' => sip_auth_username, + 'SipAuthPassword' => sip_auth_password, } payload = @version.create( 'POST', @uri, @@ -99,11 +101,11 @@ ) return CallInstance.new( @version, payload, - account_sid: @solution['account_sid'], + account_sid: @solution[:account_sid], ) end ## # Lists CallInstance records from the API as a list. @@ -124,11 +126,10 @@ # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when not set will use # the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the # limit with the most efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results def list(to: nil, from: nil, parent_call_sid: nil, status: nil, start_time_before: nil, start_time: nil, start_time_after: nil, end_time_before: nil, end_time: nil, end_time_after: nil, limit: nil, page_size: nil) self.stream( to: to, from: from, @@ -164,11 +165,10 @@ # guarantees to never return more than limit. Default is no limit # @param [Integer] page_size Number of records to fetch per request, when not set will use # the default value of 50 records. If no page_size is defined # but a limit is defined, stream() will attempt to read the # limit with the most efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results def stream(to: nil, from: nil, parent_call_sid: nil, status: nil, start_time_before: nil, start_time: nil, start_time_after: nil, end_time_before: nil, end_time: nil, end_time_after: nil, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( @@ -236,11 +236,10 @@ # @param [Time] end_time EndTime to filter on # @param [Time] end_time_after: EndTime to filter on # @param [String] page_token PageToken provided by the API # @param [Integer] page_number Page Number, this value is simply for client state # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of CallInstance def page(to: nil, from: nil, parent_call_sid: nil, status: nil, start_time_before: nil, start_time: nil, start_time_after: nil, end_time_before: nil, end_time: nil, end_time_after: nil, page_token: nil, page_number: nil, page_size: nil) params = { 'To' => to, 'From' => from, @@ -265,11 +264,10 @@ end ## # Access the feedback_summaries # @param [String] sid The sid - # @return [FeedbackSummaryList] FeedbackSummaryList def feedback_summaries(sid=:unset) if sid != :unset return FeedbackSummaryContext.new( @version, @@ -297,11 +295,10 @@ # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @param [String] account_sid The unique id of the Account responsible for # creating this Call - # @return [CallPage] CallPage def initialize(version, response, solution) super(version, response) # Path Solution @@ -309,17 +306,16 @@ end ## # Build an instance of CallInstance # @param [Hash] payload Payload response from the API - # @return [CallInstance] CallInstance def get_instance(payload) return CallInstance.new( @version, payload, - account_sid: @solution['account_sid'], + account_sid: @solution[:account_sid], ) end ## # Provide a user friendly representation @@ -332,11 +328,10 @@ ## # Initialize the CallContext # @param [Version] version Version that contains the resource # @param [String] account_sid The account_sid # @param [String] sid The Call Sid that uniquely identifies the Call to fetch - # @return [CallContext] CallContext def initialize(version, account_sid, sid) super(version) # Path Solution @@ -372,12 +367,12 @@ ) return CallInstance.new( @version, payload, - account_sid: @solution['account_sid'], - sid: @solution['sid'], + account_sid: @solution[:account_sid], + sid: @solution[:sid], ) end ## # Update the CallInstance @@ -395,11 +390,10 @@ # request the `FallbackUrl`. Must be either `GET` or `POST`. Defaults to `POST`. # @param [String] status_callback A URL that Twilio will request when the call # ends to notify your app. # @param [String] status_callback_method The HTTP method that Twilio should use to # request the `StatusCallback`. Defaults to `POST`. - # @return [CallInstance] Updated CallInstance def update(url: nil, method: nil, status: nil, fallback_url: nil, fallback_method: nil, status_callback: nil, status_callback_method: nil) data = { 'Url' => url, 'Method' => method, @@ -417,12 +411,12 @@ ) return CallInstance.new( @version, payload, - account_sid: @solution['account_sid'], - sid: @solution['sid'], + account_sid: @solution[:account_sid], + sid: @solution[:sid], ) end ## # Access the recordings @@ -497,11 +491,10 @@ # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] account_sid The unique id of the Account responsible for # creating this Call # @param [String] sid The Call Sid that uniquely identifies the Call to fetch - # @return [CallInstance] CallInstance def initialize(version, payload, account_sid: nil, sid: nil) super(version) # Marshaled Properties @@ -543,11 +536,10 @@ ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @param [Version] version Version that contains the resource - # @return [CallContext] CallContext for this CallInstance def context unless @instance_context @instance_context = CallContext.new( @version, @@ -660,18 +652,18 @@ ## # Deletes the CallInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - @context.delete() + context.delete end ## # Fetch a CallInstance # @return [CallInstance] Fetched CallInstance def fetch - @context.fetch() + context.fetch end ## # Update the CallInstance # @param [String] url A valid URL that returns TwiML. Twilio will immediately @@ -688,14 +680,14 @@ # request the `FallbackUrl`. Must be either `GET` or `POST`. Defaults to `POST`. # @param [String] status_callback A URL that Twilio will request when the call # ends to notify your app. # @param [String] status_callback_method The HTTP method that Twilio should use to # request the `StatusCallback`. Defaults to `POST`. - # @return [CallInstance] Updated CallInstance def update(url: nil, method: nil, status: nil, fallback_url: nil, fallback_method: nil, status_callback: nil, status_callback_method: nil) - @context.update( + context.update( + url: url, method: method, status: status, fallback_url: fallback_url, fallback_method: fallback_method, status_callback: status_callback, @@ -705,31 +697,31 @@ ## # Access the recordings # @return [recordings] recordings def recordings - @context.recordings + context.recordings end ## # Access the notifications # @return [notifications] notifications def notifications - @context.notifications + context.notifications end ## # Access the feedback # @return [feedback] feedback def feedback - @context.feedback + context.feedback end ## # Provide a user friendly representation def to_s - context = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Api.V2010.CallInstance #{context}>" + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Api.V2010.CallInstance #{values}>" end end end end end \ No newline at end of file