protected function request($data) {
    try {
      if ($this->method == 'delete') {
        $response = $this->client->{$this->method}($this->path(), [], $data);
      }
      else {
        $response = $this->client->{$this->method}($this->path(), $data);
      }
      $this->client->close();
    }
    catch (\Exception $e) {
      // Throw an expection if something goes wrong.
      $this->triggerError($e->getMessage());
    }
    return $this->response($response);
  }
protected function request($data) {
    try {
      if ($this->method == 'delete') {
        $response = $this->client->{$this->method}($this->path(), [], $data);
      }
      else {
        $response = $this->client->{$this->method}($this->path(), $data);
      }
      $this->client->close();
    }
    catch (\Exception $e) {
      // Throw an expection if something goes wrong.
      $this->triggerError($e->getMessage());
    }
    return $this->response($response);
  }
protected function request ( $ data ) { try { if ( $ this -> method == 'delete' ) { $ response = $ this -> client -> { $ this -> method } ( $ this -> path ( ) , [ ] , $ data ) ; } else { $ response = $ this -> client -> { $ this -> method } ( $ this -> path ( ) , $ data ) ; } $ this -> client -> close ( ) ; } catch ( \ Exception $ e ) { // Throw an expection if something goes wrong. $ this -> triggerError ( $ e -> getMessage ( ) ) ; } return $ this -> response ( $ response ) ; }
Create HTTP request.

@param (array|string) $data Raw content of the request or associative array to pass to endpoints.

@return (object) HTTP Response object.
Create HTTP request .