def make_request(method, path, data = {}, api_version = 'v1', api_endpoint = '')
      d  = camelcase(data)
      build_path = lambda {|path| "/#{api_version}" + (if path[0] == "/" then path else "/#{path}" end) }
      
      # A somewhat less ideal solution to the V1/V2 endpoint split
      # If no endpoint is defined, use default connection
      if api_endpoint.length == 0
        create_connection = @create_connection
      # Otherwise retrieve (or create if needed) the connection based on the given api_endpoint
      else
        if not @created_connections.key?(api_endpoint)
          new_connection = lambda{||
            Faraday.new(api_endpoint) { |faraday|
              faraday.basic_auth(@api_token, @api_secret)
              faraday.headers['Accept'] = 'application/json'
              faraday.headers['User-Agent'] = "ruby-bandwidth/v#{Bandwidth::VERSION}"
              @set_adapter.call(faraday)
              @configure_connection.call(faraday) if @configure_connection
            }
          }
          @created_connections[api_endpoint] = new_connection
        end
        create_connection = @created_connections[api_endpoint]
      end

      connection = create_connection.call()
      response =  if method == :get || method == :delete
                    connection.run_request(method, build_path.call(path), nil, nil) do |req|
                      req.params = d unless d == nil || d.empty?
                    end
                  else
                    connection.run_request(method, build_path.call(path), d.to_json(), {'Content-Type' => 'application/json'})
                  end
      check_response(response)
      r = if response.body.strip().size > 0 then symbolize(JSON.parse(response.body)) else {} end
      [r, symbolize(response.headers || {})]
    end
def make_request(method, path, data = {}, api_version = 'v1', api_endpoint = '')
      d  = camelcase(data)
      build_path = lambda {|path| "/#{api_version}" + (if path[0] == "/" then path else "/#{path}" end) }
      
      # A somewhat less ideal solution to the V1/V2 endpoint split
      # If no endpoint is defined, use default connection
      if api_endpoint.length == 0
        create_connection = @create_connection
      # Otherwise retrieve (or create if needed) the connection based on the given api_endpoint
      else
        if not @created_connections.key?(api_endpoint)
          new_connection = lambda{||
            Faraday.new(api_endpoint) { |faraday|
              faraday.basic_auth(@api_token, @api_secret)
              faraday.headers['Accept'] = 'application/json'
              faraday.headers['User-Agent'] = "ruby-bandwidth/v#{Bandwidth::VERSION}"
              @set_adapter.call(faraday)
              @configure_connection.call(faraday) if @configure_connection
            }
          }
          @created_connections[api_endpoint] = new_connection
        end
        create_connection = @created_connections[api_endpoint]
      end

      connection = create_connection.call()
      response =  if method == :get || method == :delete
                    connection.run_request(method, build_path.call(path), nil, nil) do |req|
                      req.params = d unless d == nil || d.empty?
                    end
                  else
                    connection.run_request(method, build_path.call(path), d.to_json(), {'Content-Type' => 'application/json'})
                  end
      check_response(response)
      r = if response.body.strip().size > 0 then symbolize(JSON.parse(response.body)) else {} end
      [r, symbolize(response.headers || {})]
    end
Make HTTP request to Catapult API
 @param method [Symbol] http method to make
 @param path [String] path of url (exclude api verion and endpoint) to make call
 @param data [Hash] data  which will be sent with request (for :get and :delete request they will be sent with query in url)
 @return [Array] array with 2 elements: parsed json data of response and response headers