Пример #1
0
 /**
  * @param       bool            $returnResponse     If true the CreateAccessTokenResponse will be returned
  * @return      CreateAccessTokenResponse
  * @throws      RequiredFieldMissingException|UnauthorizedClientException
  */
 public function requestAccessToken($returnResponse = false)
 {
     try {
         $accessTokenResponse = $this->api->requestAccessToken($returnResponse);
         if ($returnResponse) {
             return $accessTokenResponse;
         } else {
             return null;
         }
     } catch (RequestException $ex) {
         $caravanaException = CaravanaExceptionFactory::parseRequestException($ex);
         throw $caravanaException;
     }
 }
 public function testOAuthToken()
 {
     $api = new Api('./');
     $result = $api->requestAccessToken(true);
     $this->assertInstanceOf('Caravana\\API\\Models\\Responses\\OAuth\\CreateAccessTokenResponse', $result);
 }