lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.0.0.rc21 vs lib/twilio-ruby/rest/api/v2010/account/call.rb in twilio-ruby-5.0.0.rc22

- old
+ new

@@ -83,12 +83,12 @@ # 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_event: nil, status_callback_method: nil, send_digits: nil, if_machine: nil, timeout: nil, record: nil, recording_channels: nil, recording_status_callback: nil, recording_status_callback_method: nil, sip_auth_username: nil, sip_auth_password: nil, machine_detection: nil, machine_detection_timeout: nil, url: nil, application_sid: nil) - data = { + 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, if_machine: :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, url: :unset, application_sid: :unset) + data = Twilio::Values.of({ 'To' => to, 'From' => from, 'Url' => url, 'ApplicationSid' => application_sid, 'Method' => method, @@ -106,19 +106,19 @@ 'RecordingStatusCallbackMethod' => recording_status_callback_method, 'SipAuthUsername' => sip_auth_username, 'SipAuthPassword' => sip_auth_password, 'MachineDetection' => machine_detection, 'MachineDetectionTimeout' => machine_detection_timeout, - } + }) payload = @version.create( 'POST', @uri, data: data ) - return CallInstance.new( + CallInstance.new( @version, payload, account_sid: @solution[:account_sid], ) end @@ -139,11 +139,11 @@ # @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: nil, end_time: nil, limit: nil, page_size: nil) + def list(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, end_time: :unset, limit: nil, page_size: nil) self.stream( to: to, from: from, parent_call_sid: parent_call_sid, status: status, @@ -170,11 +170,11 @@ # @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: nil, end_time: nil, limit: nil, page_size: nil) + def stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, end_time: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( to: to, from: from, @@ -229,31 +229,44 @@ # @param [Time] end_time Only show call that ended on this date # @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: nil, end_time: nil, page_token: nil, page_number: nil, page_size: nil) - params = { + def page(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, end_time: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'To' => to, 'From' => from, 'ParentCallSid' => parent_call_sid, 'Status' => status, 'StartTime' => Twilio.serialize_iso8601(start_time), 'EndTime' => Twilio.serialize_iso8601(end_time), 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return CallPage.new(@version, response, @solution) + CallPage.new(@version, response, @solution) end ## + # Retrieve a single page of CallInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of CallInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + CallPage.new(@version, response, @solution) + end + + ## # Access the feedback_summaries # @param [String] sid The sid # @return [FeedbackSummaryList] FeedbackSummaryList def feedback_summaries(sid=:unset) if sid != :unset @@ -296,11 +309,11 @@ ## # Build an instance of CallInstance # @param [Hash] payload Payload response from the API # @return [CallInstance] CallInstance def get_instance(payload) - return CallInstance.new( + CallInstance.new( @version, payload, account_sid: @solution[:account_sid], ) end @@ -337,26 +350,26 @@ ## # Deletes the CallInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Fetch a CallInstance # @return [CallInstance] Fetched CallInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return CallInstance.new( + CallInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) @@ -379,28 +392,28 @@ # @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 = { + def update(url: :unset, method: :unset, status: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_method: :unset) + data = Twilio::Values.of({ 'Url' => url, 'Method' => method, 'Status' => status, 'FallbackUrl' => fallback_url, 'FallbackMethod' => fallback_method, 'StatusCallback' => status_callback, 'StatusCallbackMethod' => status_callback_method, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return CallInstance.new( + CallInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) @@ -456,11 +469,11 @@ ## # Access the feedback # @return [FeedbackList] FeedbackList def feedback - return FeedbackContext.new( + FeedbackContext.new( @version, @solution[:account_sid], @solution[:sid], ) end @@ -669,10 +682,10 @@ # @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) + def update(url: :unset, method: :unset, status: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, status_callback_method: :unset) context.update( url: url, method: method, status: status, fallback_url: fallback_url, \ No newline at end of file