private function getClient()
 {
     if (!$this->client) {
         $this->xpdo->loadClass('rest.modRestClient', '', false, true);
         $this->client = new modRestClient($this->xpdo);
         if ($this->client) {
             $this->client->getConnection();
             $this->client->setResponseType('json');
         }
     }
     return $this->client;
 }
    /**
     * Send a REST request
     *
     * @access public
     * @param string $host The host of the REST server.
     * @param string $path The path to request to on the REST server.
     * @param string $method The HTTP method to use for the request. May be GET,
     * PUT or POST.
     * @param array $params An array of parameters to send with the request.
     * @param array $options An array of options to pass to the request.
     * @return modRestResponse The response object.
     */
    public function request($host,$path,$method = 'GET',array $params = array(),array $options = array()) {
        if (!is_object($this->conn)) {
            $loaded = $this->getConnection();
            if (!$loaded) return false;
        }
        $this->host = $host;
        $response = $this->conn->request($this->host,$path,$method,$params,$options);

        $responseClass = $this->modx->getOption(modRestClient::OPT_RESPONSE_CLASS,$this->config,'modRestResponse');
        $this->response = new $responseClass($this,$response,$this->responseType);

        return $this->response;
    }
 function __construct(modX &$modx,array $config = array()) {
     parent::__construct($modx, $config);
     $this->config = array_merge(array(
     ),$this->config);
 }