Sha256: e7fbb97f4fb33a195c591eca544ef961cb9cccdfe7451c43119277862f4c141d

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2015 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require 'salesforce_bulk_query'

require_relative 'base_middleware'

module GoodData
  module Bricks
    class BulkSalesforceMiddleware < Bricks::Middleware
      DEFAULT_VERSION = '29.0'.freeze

      def self.create_client(params)
        salesforce = nil
        if params['salesforce_client']

          client = params['salesforce_client']
          client.authenticate!

          salesforce = SalesforceBulkQuery::Api.new(client, logger: params['GDC_LOGGER'])
          # SalesforceBulkQuery adds its own Restforce logging so turn it off
          Restforce.log = false if params['GDC_LOGGER']
        end
        params.merge('salesforce_bulk_client' => salesforce)
      end

      def call(params)
        params = params.to_hash
        params = self.class.create_client(params)
        @app.call(params)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gooddata-bricks-0.8.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.7.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.6.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.5.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.4.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.3.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.2.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb
gooddata-bricks-0.1.0 lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb