Пример #1
0
function authorizeFromEnv()
{
    $apiToken = getenv('CLEVER_API_TOKEN');
    if (!$apiToken) {
        $apiToken = "DEMO_TOKEN";
    }
    Clever::setToken($apiToken);
}
Пример #2
0
 public function testInvalidCredentials()
 {
     Clever::setApiKey('invalid');
     try {
         CleverDistrict::all();
     } catch (CleverAuthenticationError $e) {
         $this->assertEquals(401, $e->getHttpStatus());
     }
 }
Пример #3
0
 public function testToken()
 {
     Clever::setApiKey(null);
     // Unset any apiKey
     Clever::setToken('DEMO_TOKEN');
     $schools = CleverSchool::all();
     foreach ($schools as $school) {
         $this->assertEquals(get_class($school), "CleverSchool");
         $this->assertEquals($school->instanceUrl(), "/schools/" . $school->id);
         $schoolBefore = clone $school;
         $school->refresh();
         $this->assertEquals($schoolBefore, $school);
     }
 }
Пример #4
0
 public static function setVerifySslCerts($verify)
 {
     self::$verifySslCerts = $verify;
 }
 /**
  * set/change the token after the fact
  */
 function setToken($token)
 {
     \Clever::setToken($this->token = $token);
 }