protected function request($method, $url, array $headers = [], $body = '')
    {
        $debug = getenv('DEBUG_SDK') || defined('DEBUG_SDK');

        $request = $this->connector->createRequest($url, $method, $headers, $body);
        if ($debug) {
            $clientConfig = $this->connector->getClient()->getConfig();
            $baseUri = isset($clientConfig['base_uri']) ? $clientConfig['base_uri'] : '';
            $debugHeaders = $request->getHeaders();
            $debugHeaders = json_encode($debugHeaders);
            echo <<<DEBUG_BODY
DEBUG MODE: Request
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    {$method} : {$baseUri}{$url}
Headers : $debugHeaders
   Body : {$request->getBody()}
\n
DEBUG_BODY;
        }

        $response = $this->connector->send($request);

        if ($debug) {
            $debugHeaders = json_encode($response->getHeaders());
            echo <<<DEBUG_BODY
DEBUG MODE: Response
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Headers : $debugHeaders
   Body : {$response->getBody()}
\n
DEBUG_BODY;
        }

        return new ResponseValidator($response);
    }
protected function request($method, $url, array $headers = [], $body = '')
    {
        $debug = getenv('DEBUG_SDK') || defined('DEBUG_SDK');

        $request = $this->connector->createRequest($url, $method, $headers, $body);
        if ($debug) {
            $clientConfig = $this->connector->getClient()->getConfig();
            $baseUri = isset($clientConfig['base_uri']) ? $clientConfig['base_uri'] : '';
            $debugHeaders = $request->getHeaders();
            $debugHeaders = json_encode($debugHeaders);
            echo <<<DEBUG_BODY
DEBUG MODE: Request
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    {$method} : {$baseUri}{$url}
Headers : $debugHeaders
   Body : {$request->getBody()}
\n
DEBUG_BODY;
        }

        $response = $this->connector->send($request);

        if ($debug) {
            $debugHeaders = json_encode($response->getHeaders());
            echo <<<DEBUG_BODY
DEBUG MODE: Response
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Headers : $debugHeaders
   Body : {$response->getBody()}
\n
DEBUG_BODY;
        }

        return new ResponseValidator($response);
    }
protected function request ( $ method , $ url , array $ headers = [ ] , $ body = '' ) { $ debug = getenv ( 'DEBUG_SDK' ) || defined ( 'DEBUG_SDK' ) ; $ request = $ this -> connector -> createRequest ( $ url , $ method , $ headers , $ body ) ; if ( $ debug ) { $ clientConfig = $ this -> connector -> getClient ( ) -> getConfig ( ) ; $ baseUri = isset ( $ clientConfig [ 'base_uri' ] ) ? $ clientConfig [ 'base_uri' ] : '' ; $ debugHeaders = $ request -> getHeaders ( ) ; $ debugHeaders = json_encode ( $ debugHeaders ) ; echo  <<<DEBUG_BODY
DEBUG MODE: Request
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    {$method} : {$baseUri}{$url}
Headers : $debugHeaders
   Body : {$request->getBody()}
\n
DEBUG_BODY ; } $ response = $ this -> connector -> send ( $ request ) ; if ( $ debug ) { $ debugHeaders = json_encode ( $ response -> getHeaders ( ) ) ; echo  <<<DEBUG_BODY
DEBUG MODE: Response
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Headers : $debugHeaders
   Body : {$response->getBody()}
\n
DEBUG_BODY ; } return new ResponseValidator ( $ response ) ; }
Sends a HTTP request to the specified url.

@param string $method HTTP method, e.g. 'GET'
@param string $url Request destination
@param array $headers
@param string $body

@throws ConnectorException When the API replies with an error response
@throws RequestException   When an error is encountered
@throws \LogicException    When Guzzle cannot populate the response'
@return ResponseValidator When the API replies with an error response
Sends a HTTP request to the specified url .