Esempio n. 1
0
 public static function factory(Nitrapi $api, array $options = array())
 {
     $data = $api->dataGet("services/" . $options['id'], null);
     $type = $data['service']['type'];
     $class = "Nitrapi\\Services\\" . ucfirst($type) . "s\\" . ucfirst($type);
     if (!class_exists($class)) {
         throw new NitrapiServiceTypeNotFoundException("Class for Type " . $type . " not found");
     }
     return new $class($api, $data['service']);
 }
Esempio n. 2
0
 public function __construct(Nitrapi $api, $token)
 {
     $this->api = $api;
     $this->data = $api->dataGet("user?access_token=" . $token, null);
 }