Exemplo n.º 1
0
 public static function run($id, $attribs = array())
 {
     $response = GameRocket_Http::post('/games/' . GameRocket_Configuration::apikey() . '/actions/' . $id . '/run', $attribs);
     if (isset($response['error'])) {
         return new GameRocket_Result_Error($response);
     } else {
         return new GameRocket_Result_Successful(GameRocket_Map::factory($response));
     }
 }
Exemplo n.º 2
0
 public static function find($id)
 {
     self::_validateId($id);
     try {
         $response = GameRocket_Http::get('/games/' . $id);
         return self::factory($response['game']);
     } catch (GameRocket_Exception_NotFound $e) {
         throw new GameRocket_Exception_NotFound('Game with id ' . $id . ' not found.');
     }
 }
Exemplo n.º 3
0
 public static function find($player, $id, $params)
 {
     self::_validateId($player);
     self::_validateId($id);
     try {
         $response = GameRocket_Http::get('/players/' . $player . '/achievements/' . $id, $params);
         return self::factory($response['achievement']);
     } catch (GameRocket_Exception_NotFound $e) {
         throw new GameRocket_Exception_NotFound('Achievement with id ' . $id . ' not found.');
     }
 }
Exemplo n.º 4
0
 public static function delete($playerId)
 {
     self::_validateId($playerId);
     GameRocket_Http::delete('/players/' . $playerId);
     return new GameRocket_Result_Successful();
 }