def options(verb, path, params, request_headers, options)
      poll_timeout = verb == :poll && options[:poll_timeout]
      connect_options = {
        :connect_timeout => options[:open_timeout] || BalancedHttpClient::DEFAULT_OPEN_TIMEOUT,
        :inactivity_timeout => poll_timeout || options[:request_timeout] || BalancedHttpClient::DEFAULT_REQUEST_TIMEOUT }
      connect_options[:proxy] = @proxy if @proxy

      request_body, request_path = if [:get, :delete].include?(verb)
        # Doing own formatting because :query option on EM::HttpRequest does not reliably
        # URL encode, e.g., messes up on arrays in hashes
        [nil, (params.is_a?(Hash) && params.any?) ? path + "?#{BalancedHttpClient.format(params)}" : path]
      else
        request_headers[:content_type] = "application/json"
        [(params.is_a?(Hash) && params.any?) ? JSON.dump(params) : nil, path]
      end
      request_options = {:path => request_path, :body => request_body, :head => request_headers}
      request_options[:keepalive] = true if verb == :poll
      [connect_options, request_options]
    end
def options(verb, path, params, request_headers, options)
      poll_timeout = verb == :poll && options[:poll_timeout]
      connect_options = {
        :connect_timeout => options[:open_timeout] || BalancedHttpClient::DEFAULT_OPEN_TIMEOUT,
        :inactivity_timeout => poll_timeout || options[:request_timeout] || BalancedHttpClient::DEFAULT_REQUEST_TIMEOUT }
      connect_options[:proxy] = @proxy if @proxy

      request_body, request_path = if [:get, :delete].include?(verb)
        # Doing own formatting because :query option on EM::HttpRequest does not reliably
        # URL encode, e.g., messes up on arrays in hashes
        [nil, (params.is_a?(Hash) && params.any?) ? path + "?#{BalancedHttpClient.format(params)}" : path]
      else
        request_headers[:content_type] = "application/json"
        [(params.is_a?(Hash) && params.any?) ? JSON.dump(params) : nil, path]
      end
      request_options = {:path => request_path, :body => request_body, :head => request_headers}
      request_options[:keepalive] = true if verb == :poll
      [connect_options, request_options]
    end
Initialize client

 @option options [String] :api_version for X-API-Version header
 @option options [String] :health_check_path in URI for health check resource;
   defaults to BalancedHttpClient::DEFAULT_HEALTH_CHECK_PATH
 Construct options for HTTP request

 @param [Symbol] verb for HTTP REST request
 @param [String] path in URI for desired resource
 @param [Hash] params for HTTP request
 @param [String] request_headers to be applied to request

 @option options [Numeric] :open_timeout maximum wait for connection; defaults to DEFAULT_OPEN_TIMEOUT
 @option options [Numeric] :request_timeout maximum wait for response; defaults to DEFAULT_REQUEST_TIMEOUT
 @option options [Numeric] :poll_timeout maximum wait for individual poll; defaults to :request_timeout

 @return [Array] connect and request option hashes