/** * Send request and return response data. * * @param string $method * @param string $path * @param array $data * @param array $options * @return string */ public function send($method, $path = null, $data = null, $options = array()) { $defaults = array('return' => 'body'); $options += $defaults; if (!$this->connect()) { return; } $request = $this->_request($method, $path, $data, $options); $response = $this->_connection->send($request, array('classes' => $this->_classes)); if ($response) { $this->last = (object) compact('request', 'response'); $this->disconnect(); return $options['return'] == 'body' ? $response->body() : $response; } }