protected function buildOptions($data = null)
    {
        $options = array(
            'query' => $this->buildQuery($data),
            'debug' => $this->getOption('debug', false),
            'timeout' => $this->getOption('timeout', 0)
        );

        if (!is_null($data) && !($data instanceof Criteria)) {
            $options['json'] = $data;
        }

        return $options;
    }