lib/ecoportal/api/common/graphql/auth_service.rb in ecoportal-api-graphql-0.1.0 vs lib/ecoportal/api/common/graphql/auth_service.rb in ecoportal-api-graphql-0.1.1

- old
+ new

@@ -11,27 +11,25 @@ http_client(host: host, version: version).post("/oauth/token", data: { "grant_type" => "password", "email" => user_email, "password" => user_pass }).yield_self do |response| - if response.success? - response.body["access_token"] - end + response.body["access_token"] if response.success? end end private def http_client(host: server, version: nil) @http_client ||= Ecoportal::API::Common::GraphQL::HttpClient.new(host: host, version: version) end def user_email - fetch_env_required("USER_EMAIL") + @user_email || fetch_env_required("USER_EMAIL") end def user_pass - fetch_env_required("USER_PASS") + @user_pass || fetch_env_required("USER_PASS") end def server(default = DEFAULT_SERVER) ENV['SERVER'] || default end