lib/gooddata/bricks/middleware/gooddata_middleware.rb in gooddata-0.6.0.pre11 vs lib/gooddata/bricks/middleware/gooddata_middleware.rb in gooddata-0.6.0

- old
+ new

@@ -1,31 +1,31 @@ +# encoding: UTF-8 + require 'gooddata' -require File.join(File.dirname(__FILE__), "base_middleware") +require_relative 'base_middleware' module GoodData::Bricks class GoodDataMiddleware < GoodData::Bricks::Middleware - def call(params) - logger = params["GDC_LOGGER"] - token_name = "GDC_SST" - protocol_name = "GDC_PROTOCOL" - server_name = "GDC_HOSTNAME" - project_id = params["GDC_PROJECT_ID"] + logger = params['GDC_LOGGER'] + token_name = 'GDC_SST' + protocol_name = 'GDC_PROTOCOL' + server_name = 'GDC_HOSTNAME' + project_id = params['GDC_PROJECT_ID'] - fail "SST (SuperSecureToken) not present in params" if params[token_name].nil? + fail 'SST (SuperSecureToken) not present in params' if params[token_name].nil? server = if !params[protocol_name].empty? && !params[server_name].empty? - params[protocol_name] + "://" + params[server_name] - end + "#{params[protocol_name]}://#{params[server_name]}" + end - fail "GoodData username is missing. Expected param \"GDC_USERNAME\"" if params["GDC_USERNAME"].nil? - fail "GoodData password is missing. Expected param \"GDC_PASSWORD\"" if params["GDC_PASSWORD"].nil? + fail 'GoodData username is missing. Expected param :GDC_USERNAME' if params['GDC_USERNAME'].nil? + fail 'GoodData password is missing. Expected param :GDC_PASSWORD' if params['GDC_PASSWORD'].nil? - GoodData.connect(params["GDC_USERNAME"], params["GDC_PASSWORD"], {:server => server}) + GoodData.connect(params['GDC_USERNAME'], params['GDC_PASSWORD'], {:server => server}) GoodData.logger = logger GoodData.with_project(project_id) do |p| @app.call(params) end end - end end \ No newline at end of file