protected function request($method, $url, $options = [])
    {
        $client = $this->getClient();
        try {
            $response = $client->request($method, $url, $options);
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            $response = $e->getResponse();
            throw new PeopleMatterException($response->getStatusCode().": ".$response->getReasonPhrase(), 1, $e);
        }

        $body = $response->getBody();
        if (!is_array($body)) {
            $json = json_decode($body, true);
        } else {
            $json = $body;
        }

        if (!empty($json["ErrorMessage"])) {
            throw new PeopleMatterException($json["ErrorMessage"], $json["ErrorCode"]);
        }

        return $json;
    }
protected function request($method, $url, $options = [])
    {
        $client = $this->getClient();
        try {
            $response = $client->request($method, $url, $options);
        } catch (\GuzzleHttp\Exception\ClientException $e) {
            $response = $e->getResponse();
            throw new PeopleMatterException($response->getStatusCode().": ".$response->getReasonPhrase(), 1, $e);
        }

        $body = $response->getBody();
        if (!is_array($body)) {
            $json = json_decode($body, true);
        } else {
            $json = $body;
        }

        if (!empty($json["ErrorMessage"])) {
            throw new PeopleMatterException($json["ErrorMessage"], $json["ErrorCode"]);
        }

        return $json;
    }
protected function request ( $ method , $ url , $ options = [ ] ) { $ client = $ this -> getClient ( ) ; try { $ response = $ client -> request ( $ method , $ url , $ options ) ; } catch ( \ GuzzleHttp \ Exception \ ClientException $ e ) { $ response = $ e -> getResponse ( ) ; throw new PeopleMatterException ( $ response -> getStatusCode ( ) . ": " . $ response -> getReasonPhrase ( ) , 1 , $ e ) ; } $ body = $ response -> getBody ( ) ; if ( ! is_array ( $ body ) ) { $ json = json_decode ( $ body , true ) ; } else { $ json = $ body ; } if ( ! empty ( $ json [ "ErrorMessage" ] ) ) { throw new PeopleMatterException ( $ json [ "ErrorMessage" ] , $ json [ "ErrorCode" ] ) ; } return $ json ; }
Executes a request to the PeopleMatter API
@param  string $method  The request type
@param  string $url     The url to request
@param  array  $options An array of options for the request
@return array           The response as an array
Executes a request to the PeopleMatter API