From d97a9a5e8cfced15069284c6d0b02e8931f02f23 Mon Sep 17 00:00:00 2001 From: Blag Date: Fri, 1 Mar 2024 12:32:21 -0500 Subject: [PATCH] Update http_client.rb to fix detect_provider problem (#469) * Update http_client.rb to fix detect_provider problem Detect Provider calls build_query method from Auth.rb instead of http_client.rb. By renaming the private method build_query to build_http_query on http_client.rb the problem is solved. * Add build_http_query to spec * Renamed build_query on Auth instead of http_client --- lib/nylas/resources/auth.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/nylas/resources/auth.rb b/lib/nylas/resources/auth.rb index 6c30c066..e303a6c7 100644 --- a/lib/nylas/resources/auth.rb +++ b/lib/nylas/resources/auth.rb @@ -118,7 +118,7 @@ def detect_provider(params) # @return [String] Updated list of parameters, including those specific to admin # consent. def build_query_with_admin_consent(config) - params = build_query(config) + params = build_http_query(config) # Appends new params specific for admin consent. params[:provider] = "microsoft" @@ -135,7 +135,7 @@ def build_query_with_admin_consent(config) # @return [String] Updated list of encoded parameters, including those specific # to PKCE. def build_query_with_pkce(config, secret_hash) - params = build_query(config) + params = build_http_query(config) # Appends new PKCE specific params. params[:code_challenge_method] = "s256" @@ -151,7 +151,7 @@ def build_query_with_pkce(config, secret_hash) def url_auth_builder(config) builder = URI.parse(api_uri) builder.path = "/v3/connect/auth" - builder.query = URI.encode_www_form(build_query(config)).gsub(/\+/, "%20") + builder.query = URI.encode_www_form(build_http_query(config)).gsub(/\+/, "%20") builder end @@ -160,7 +160,7 @@ def url_auth_builder(config) # # @param config [Hash] Configuration for the query. # @return [Hash] List of parameters to encode in the query. - def build_query(config) + def build_http_query(config) params = { client_id: config[:client_id], redirect_uri: config[:redirect_uri],