예제 #1
0
 /** Initialisates the API for use with a specific user.
  *
  * MUST be called before using any of the API methods.
  *
  *
  * @param object $user_authorisation JK_UserAuthorisation instance.
  * @throws InvalidArgumentException If $user_authorisation is NULL or not an instance of JK_UserAuthorisation.
  * */
 public static final function init(JK_UserAuthorisation $user_authorisation)
 {
     if ($user_authorisation == NULL) {
         throw new InvalidArgumentException('NULL $user_authoristion passed to Jabbakam::init()');
     }
     if (!is_a($user_authorisation, 'JK_UserAuthorisation')) {
         throw new InvalidArgumentException('non JK_UserAuthorisation passed to Jabbakam::init()');
     }
     if (self::$ch == NULL) {
         self::_initCurl();
     }
     self::$user_auth = new OAuthToken($user_authorisation->getKey(), $user_authorisation->getSecretKey());
     self::$consumer = new OAuthConsumer(JABBAKAM_KEY, JABBAKAM_SECRET_KEY, NULL);
     self::$sig_method = new OAuthSignatureMethod_HMAC_SHA1();
 }