コード例 #1
0
ファイル: ApiResource.php プロジェクト: clever/clever-php
 protected static function _scopedCreate($class, $params = null, $auth = null)
 {
     self::_validateCall('create', $params, $auth);
     $requestor = new CleverApiRequestor($auth);
     $url = self::classUrl($class);
     list($response, $auth) = $requestor->request('post', $url, $params);
     return CleverUtil::convertToCleverObject($response, $auth);
 }
コード例 #2
0
ファイル: School.php プロジェクト: clever/clever-php
 public function __call($method, $args)
 {
     if (array_key_exists($method, self::$secondLevelEndpoints)) {
         $params = $args && count($args) ? $args[0] : array();
         $requestor = new CleverApiRequestor($this->_auth);
         $url = $this->instanceUrl() . '/' . $method;
         list($response, $auth) = $requestor->request('get', $url, $params);
         return CleverUtil::convertToCleverObject($response, $this->_auth);
     }
     throw new UndefinedEndpointException(__CLASS__ . " endpoint '{$method}' is not defined.");
 }