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

- old
+ new

@@ -92,25 +92,38 @@ # Request is executed immediately. # @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 KeyInstance - def page(page_token: nil, page_number: nil, page_size: nil) - params = { + def page(page_token: :unset, page_number: :unset, page_size: :unset) + params = Twilio::Values.of({ 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, - } + }) response = @version.page( 'GET', @uri, params ) - return KeyPage.new(@version, response, @solution) + KeyPage.new(@version, response, @solution) end ## + # Retrieve a single page of KeyInstance records from the API. + # Request is executed immediately. + # @param [String] target_url API-generated URL for the requested results page + # @return [Page] Page of KeyInstance + def get_page(target_url) + response = @version.domain.request( + 'GET', + target_url + ) + KeyPage.new(@version, response, @solution) + end + + ## # Provide a user friendly representation def to_s '#<Twilio.Api.V2010.KeyList>' end end @@ -134,11 +147,11 @@ ## # Build an instance of KeyInstance # @param [Hash] payload Payload response from the API # @return [KeyInstance] KeyInstance def get_instance(payload) - return KeyInstance.new( + KeyInstance.new( @version, payload, account_sid: @solution[:account_sid], ) end @@ -170,19 +183,19 @@ ## # Fetch a KeyInstance # @return [KeyInstance] Fetched KeyInstance def fetch - params = {} + params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) - return KeyInstance.new( + KeyInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) @@ -190,22 +203,22 @@ ## # Update the KeyInstance # @param [String] friendly_name The friendly_name # @return [KeyInstance] Updated KeyInstance - def update(friendly_name: nil) - data = { + def update(friendly_name: :unset) + data = Twilio::Values.of({ 'FriendlyName' => friendly_name, - } + }) payload = @version.update( 'POST', @uri, data: data, ) - return KeyInstance.new( + KeyInstance.new( @version, payload, account_sid: @solution[:account_sid], sid: @solution[:sid], ) @@ -213,11 +226,11 @@ ## # Deletes the KeyInstance # @return [Boolean] true if delete succeeds, true otherwise def delete - return @version.delete('delete', @uri) + @version.delete('delete', @uri) end ## # Provide a user friendly representation def to_s @@ -295,10 +308,10 @@ ## # Update the KeyInstance # @param [String] friendly_name The friendly_name # @return [KeyInstance] Updated KeyInstance - def update(friendly_name: nil) + def update(friendly_name: :unset) context.update( friendly_name: friendly_name, ) end \ No newline at end of file