Example #1
0
 /**
  * Queries the API for a new Token and saves it as self._token.
  *
  * @param string $email users email-address
  * @param string $password users password
  *
  * @throws TokenRequiredError
  * @throws BadRequestError
  * @throws UnauthorizedError
  * @throws ForbiddenError
  * @throws ConflictDuplicateError
  * @throws GoneError
  * @throws InternalServerError
  * @throws NotImplementedError
  * @throws ThrottledError
  * @throws CCException
  *
  * @return $this
  */
 public function auth($email, $password)
 {
     $request = new Request($this->_url);
     $request->setAuth($email, $password);
     $content = $request->post('/token/', array());
     $tokenObject = $this->_jsonDecode($content);
     return $this->setToken($tokenObject->token);
 }