def perform_request(action, args, options = {})
      params = serialize_args(args)
               .merge(expand_options(options))
               .merge({ action => '' })

      # Serialize the params for submission??
      params.stringify_keys!

      log_action(params)

      # yield params if block_given?

      response = get_typhoeus_connection(params)

      http_status = "#{response.response_code}:#{response.return_code}"

      case response.response_code
      when 200
        [response, params]
      when 401
        raise Errors::AuthenticationError,
              "[#{http_status}] Authentication failed."
      when 0
        if response.return_code == :operation_timedout
          raise Errors::HttpTimeoutError,
                "[#{http_status}] Current timeout value is #{timeout}"
        else
          raise Errors::CommunicationError,
                "[#{http_status}] Empty response."
        end
      when 404
        raise Errors::CommunicationError,
              "[#{http_status}] Not found"
      when 302
        raise Errors::CommunicationError,
              "[#{http_status}] Redirect not supported"
      when 502
        raise Errors::CommunicationError,
              "[#{http_status}] Bad gateway. Too many records."
      else
        msg = "Unknown response code = #{http_status}"
        raise Errors::CommunicationError, msg
      end
    end
def perform_request(action, args, options = {})
      params = serialize_args(args)
               .merge(expand_options(options))
               .merge({ action => '' })

      # Serialize the params for submission??
      params.stringify_keys!

      log_action(params)

      # yield params if block_given?

      response = get_typhoeus_connection(params)

      http_status = "#{response.response_code}:#{response.return_code}"

      case response.response_code
      when 200
        [response, params]
      when 401
        raise Errors::AuthenticationError,
              "[#{http_status}] Authentication failed."
      when 0
        if response.return_code == :operation_timedout
          raise Errors::HttpTimeoutError,
                "[#{http_status}] Current timeout value is #{timeout}"
        else
          raise Errors::CommunicationError,
                "[#{http_status}] Empty response."
        end
      when 404
        raise Errors::CommunicationError,
              "[#{http_status}] Not found"
      when 302
        raise Errors::CommunicationError,
              "[#{http_status}] Redirect not supported"
      when 502
        raise Errors::CommunicationError,
              "[#{http_status}] Bad gateway. Too many records."
      else
        msg = "Unknown response code = #{http_status}"
        raise Errors::CommunicationError, msg
      end
    end
@api private
 Mostly used by Filemaker::Api
 TODO: There must be tracing/instrumentation. CURL etc.
 Or performance metrics?
 Also we want to pass in timeout option so we can ignore timeout for really
 long requests

 @return [Array] response and request params Hash