lib/gooddata/bricks/middleware/restforce_middleware.rb in gooddata-0.6.0.pre6 vs lib/gooddata/bricks/middleware/restforce_middleware.rb in gooddata-0.6.0.pre7
- old
+ new
@@ -25,22 +25,21 @@
elsif (oauth_token && refresh_token)
{
:oauth_token => oauth_token,
:refresh_token => refresh_token
}
- else
- fail "Salesforce middleware failed while trying to log in. Either salesforce_username, salesforce_password, salesforce_token or salesforce_oauth_token, salesforce_refresh_token are needed. Additionally you have to specify salesforce_client_id and salesforce_client_secret parameters in both cases"
end
+ client = if credentials
+ credentials.merge!({
+ :client_id => client_id,
+ :client_secret => client_secret,
+ })
+ credentials[:host] = host unless host.nil?
- credentials.merge!({
- :client_id => client_id,
- :client_secret => client_secret,
- })
- credentials[:host] = host unless host.nil?
-
- Restforce.log = true if params[:salesforce_client_logger]
- client = Restforce.new(credentials)
+ Restforce.log = true if params[:salesforce_client_logger]
+ Restforce.new(credentials)
+ end
@app.call(params.merge(:salesforce_client => client))
end
end
end
\ No newline at end of file