private function validateAPIResponseCode(RequestInterface $request, ResponseInterface $response)
    {
        $responseParser = new ResponseParser($response);
        switch ($responseParser->getResponseCode()) {
            case ResponseCodes::SUCCESS:
                break;
            case ResponseCodes::NOT_AUTHORIZED:
                throw new NotAuthorizedException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::UNKNOWN_SERVICE:
                throw new UnknownServiceException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::PARAMETERS_REQUIRED:
                throw new ParametersRequiredException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::NON_EXISTING_OBJECT:
                throw new NonExistingObjectException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::UNKNOWN_ERROR:
            default:
                throw new UnknownErrorException($responseParser->getErrorMessage(), $request, $response);
        }
    }
private function validateAPIResponseCode(RequestInterface $request, ResponseInterface $response)
    {
        $responseParser = new ResponseParser($response);
        switch ($responseParser->getResponseCode()) {
            case ResponseCodes::SUCCESS:
                break;
            case ResponseCodes::NOT_AUTHORIZED:
                throw new NotAuthorizedException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::UNKNOWN_SERVICE:
                throw new UnknownServiceException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::PARAMETERS_REQUIRED:
                throw new ParametersRequiredException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::NON_EXISTING_OBJECT:
                throw new NonExistingObjectException($responseParser->getErrorMessage(), $request, $response);
            case ResponseCodes::UNKNOWN_ERROR:
            default:
                throw new UnknownErrorException($responseParser->getErrorMessage(), $request, $response);
        }
    }
private function validateAPIResponseCode ( RequestInterface $ request , ResponseInterface $ response ) { $ responseParser = new ResponseParser ( $ response ) ; switch ( $ responseParser -> getResponseCode ( ) ) { case ResponseCodes :: SUCCESS : break ; case ResponseCodes :: NOT_AUTHORIZED : throw new NotAuthorizedException ( $ responseParser -> getErrorMessage ( ) , $ request , $ response ) ; case ResponseCodes :: UNKNOWN_SERVICE : throw new UnknownServiceException ( $ responseParser -> getErrorMessage ( ) , $ request , $ response ) ; case ResponseCodes :: PARAMETERS_REQUIRED : throw new ParametersRequiredException ( $ responseParser -> getErrorMessage ( ) , $ request , $ response ) ; case ResponseCodes :: NON_EXISTING_OBJECT : throw new NonExistingObjectException ( $ responseParser -> getErrorMessage ( ) , $ request , $ response ) ; case ResponseCodes :: UNKNOWN_ERROR : default : throw new UnknownErrorException ( $ responseParser -> getErrorMessage ( ) , $ request , $ response ) ; } }
Validates the Tulip API response code.

@param RequestInterface  $request
@param ResponseInterface $response

@throws NotAuthorizedException      when not authenticated / authorized correctly.
@throws UnknownServiceException     when the called API service is not found within the Tulip API.
@throws ParametersRequiredException when the required parameters for the service / action were not provided or incorrect.
@throws NonExistingObjectException  when a requested object was not found.
@throws UnknownErrorException       when an error occurs within the Tulip API.
Validates the Tulip API response code .