lib/nylas/resources/auth.rb in nylas-6.0.0.beta.1 vs lib/nylas/resources/auth.rb in nylas-6.0.0.beta.2
- old
+ new
@@ -16,11 +16,11 @@
include ApiOperations::Post
include ApiOperations::Get
# Initializes Auth.
def initialize(sdk_instance)
- super("auth", sdk_instance)
+ super(sdk_instance)
@grants = Grants.new(sdk_instance)
end
attr_reader :grants
@@ -154,21 +154,35 @@
"client_id" => config[:client_id],
"redirect_uri" => config[:redirect_uri],
"access_type" => config[:access_type] || "online",
"response_type" => "code"
}
+ set_params(config)
+ URI.encode_www_form(params)
+ end
+
+ # Set the parameters for the query
+ def set_params(config)
params["provider"] = config[:provider] if config[:provider]
+ set_config_params(config)
+ set_more_config(config)
+ end
+
+ # Set login related configurations
+ def set_config_params(config)
if config[:login_hint]
params["login_hint"] = config[:login_hint]
params["include_grant_scopes"] = config[:include_grant_scopes].to_s if config[:include_grant_scopes]
end
params["scope"] = config[:scope].join(" ") if config[:scope]
+ end
+
+ # More config
+ def set_more_config(config)
params["prompt"] = config[:prompt] if config[:prompt]
params["metadata"] = config[:metadata] if config[:metadata]
params["state"] = config[:state] if config[:state]
-
- URI.encode_www_form(params)
end
# Hashes the secret for PKCE authentication.
#
# @param secret [String] Randomly-generated authentication secret.