Class: GoodData::Bricks::GoodDataMiddleware
- Inherits:
-
Middleware
- Object
- Middleware
- GoodData::Bricks::GoodDataMiddleware
- Defined in:
- lib/gooddata/bricks/middleware/gooddata_middleware.rb
Constant Summary collapse
- DEFAULT_PROTOCOL =
'https'- DEFAULT_HOSTNAME =
'secure.gooddata.com'
Instance Attribute Summary
Attributes inherited from Middleware
Instance Method Summary collapse
Methods inherited from Middleware
Methods included from Utils
Constructor Details
This class inherits a constructor from GoodData::Bricks::Middleware
Instance Method Details
#call(params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/gooddata/bricks/middleware/gooddata_middleware.rb', line 15 def call(params) # Convert possible jruby hash to plain hash params = params.to_hash # Transform keys params = GoodData::Helpers.deep_stringify_keys(params) # Set logger logger = params['GDC_LOGGER'] GoodData.logger = logger server = "#{params['CLIENT_GDC_PROTOCOL'] || DEFAULT_PROTOCOL}://#{params['CLIENT_GDC_HOSTNAME'] || DEFAULT_HOSTNAME}" opts = { server: server, verify_ssl: params['GDC_VERIFY_SSL'].to_b, username: params['GDC_USERNAME'], password: params['GDC_PASSWORD'], sst_token: params['GDC_SST'] } # Connect Client client = GoodData.connect(opts) opts = params['development_client'] development_client = if opts GoodData.connect(GoodData::Helpers.deep_symbolize_keys(opts)) else client end new_params = { 'GDC_GD_CLIENT' => client, 'development_client' => development_client } if params['GDC_PROJECT_ID'] new_params['gdc_project'] = GoodData.project = client.projects(params['GDC_PROJECT_ID']) end returning_value = @app.call(params.merge(new_params)) begin client.disconnect rescue puts 'Tried to disconnect. Was unsuccessful. Proceeding anyway.' end returning_value end |