Example #1
0
 public function api_findnewjob()
 {
     $bot = new Bot($this->args('bot_id'));
     if (!$bot->isHydrated()) {
         throw new Exception("Bot does not exist.");
     }
     if (!$bot->isMine()) {
         throw new Exception("This bot is not yours.");
     }
     //can we slice?
     $can_slice = $this->args('can_slice') && $bot->get('slice_engine_id') && $bot->get('slice_config_id');
     //load up our data.
     $data = array();
     $job = $bot->findNewJob($can_slice);
     if ($job->isHydrated()) {
         $data = $job->getAPIData();
     }
     //record our bot as having checked in.
     // This returns the new bot, but it's currently not needed
     $this->_markBotAsSeen($bot);
     return $data;
 }