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

- old
+ new

@@ -61,12 +61,12 @@ # @param [String] message_status_callback Twilio will make a `POST` request to # this URL to pass status parameters (such as sent or failed) to your application # if you use the `/Messages` endpoint to send the message and specify this # application's `Sid` as the `ApplicationSid` on an outgoing SMS request. # @return [ApplicationInstance] Newly created ApplicationInstance - def create(friendly_name: nil, api_version: nil, voice_url: nil, voice_method: nil, voice_fallback_url: nil, voice_fallback_method: nil, status_callback: nil, status_callback_method: nil, voice_caller_id_lookup: nil, sms_url: nil, sms_method: nil, sms_fallback_url: nil, sms_fallback_method: nil, sms_status_callback: nil, message_status_callback: nil) - data = { + def create(friendly_name: nil, api_version: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, voice_caller_id_lookup: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, sms_status_callback: :unset, message_status_callback: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ApiVersion' => api_version, 'VoiceUrl' => voice_url, 'VoiceMethod' => voice_method, 'VoiceFallbackUrl' => voice_fallback_url, @@ -78,19 +78,19 @@ 'SmsMethod' => sms_method, 'SmsFallbackUrl' => sms_fallback_url, 'SmsFallbackMethod' => sms_fallback_method, 'SmsStatusCallback' => sms_status_callback, 'MessageStatusCallback' => message_status_callback, - } + }) payload = @version.create( 'POST', @uri, data: data ) - return ApplicationInstance.new( + ApplicationInstance.new( @version, payload, account_sid: @solution[:account_sid], ) end @@ -106,11 +106,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(friendly_name: nil, limit: nil, page_size: nil) + def list(friendly_name: :unset, limit: nil, page_size: nil) self.stream( friendly_name: friendly_name, limit: limit, page_size: page_size ).entries @@ -127,11 +127,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(friendly_name: nil, limit: nil, page_size: nil) + def stream(friendly_name: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( friendly_name: friendly_name, page_size: limits[:page_size], @@ -171,26 +171,39 @@ # names that match exactly with this name # @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 ApplicationInstance - def page(friendly_name: nil, page_token: nil, page_number: nil, page_size: nil) - params = { + def page(friendly_name: :unset, page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return ApplicationPage.new(@version, response, @solution) + ApplicationPage.new(@version, response, @solution) end ## + # Retrieve a single page of ApplicationInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of ApplicationInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + ApplicationPage.new(@version, response, @solution) + end + + ## # Provide a user friendly representation def to_s '#<Twilio.Api.V2010.ApplicationList>' end end @@ -214,11 +227,11 @@ ## # Build an instance of ApplicationInstance # @param [Hash] payload Payload response from the API # @return [ApplicationInstance] ApplicationInstance def get_instance(payload) - return ApplicationInstance.new( + ApplicationInstance.new( @version, payload, account_sid: @solution[:account_sid], ) end @@ -251,26 +264,26 @@ ## # Deletes the ApplicationInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Fetch a ApplicationInstance # @return [ApplicationInstance] Fetched ApplicationInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return ApplicationInstance.new( + ApplicationInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) @@ -310,12 +323,12 @@ # @param [String] message_status_callback Twilio will make a `POST` request to # this URL to pass status parameters (such as sent or failed) to your application # if you use the `/Messages` endpoint to send the message and specify this # application's `Sid` as the `ApplicationSid` on an outgoing SMS request. # @return [ApplicationInstance] Updated ApplicationInstance - def update(friendly_name: nil, api_version: nil, voice_url: nil, voice_method: nil, voice_fallback_url: nil, voice_fallback_method: nil, status_callback: nil, status_callback_method: nil, voice_caller_id_lookup: nil, sms_url: nil, sms_method: nil, sms_fallback_url: nil, sms_fallback_method: nil, sms_status_callback: nil, message_status_callback: nil) - data = { + def update(friendly_name: :unset, api_version: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, voice_caller_id_lookup: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, sms_status_callback: :unset, message_status_callback: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'ApiVersion' => api_version, 'VoiceUrl' => voice_url, 'VoiceMethod' => voice_method, 'VoiceFallbackUrl' => voice_fallback_url, @@ -327,19 +340,19 @@ 'SmsMethod' => sms_method, 'SmsFallbackUrl' => sms_fallback_url, 'SmsFallbackMethod' => sms_fallback_method, 'SmsStatusCallback' => sms_status_callback, 'MessageStatusCallback' => message_status_callback, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return ApplicationInstance.new( + ApplicationInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) @@ -542,10 +555,10 @@ # @param [String] message_status_callback Twilio will make a `POST` request to # this URL to pass status parameters (such as sent or failed) to your application # if you use the `/Messages` endpoint to send the message and specify this # application's `Sid` as the `ApplicationSid` on an outgoing SMS request. # @return [ApplicationInstance] Updated ApplicationInstance - def update(friendly_name: nil, api_version: nil, voice_url: nil, voice_method: nil, voice_fallback_url: nil, voice_fallback_method: nil, status_callback: nil, status_callback_method: nil, voice_caller_id_lookup: nil, sms_url: nil, sms_method: nil, sms_fallback_url: nil, sms_fallback_method: nil, sms_status_callback: nil, message_status_callback: nil) + def update(friendly_name: :unset, api_version: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback: :unset, status_callback_method: :unset, voice_caller_id_lookup: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset, sms_status_callback: :unset, message_status_callback: :unset) context.update( friendly_name: friendly_name, api_version: api_version, voice_url: voice_url, voice_method: voice_method, \ No newline at end of file