Exemplo n.º 1
0
 /**
  * Define the application's command schedule.
  *
  * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
  * @return void
  */
 protected function schedule(Schedule $schedule)
 {
     $schedule->command('inspire')->hourly();
     $schedule->call(function () {
         Log::info('attaching new verified skills started');
         $skills = Skill::whereNotNull('verified_skill_id')->get();
         foreach ($skills as $skill) {
             $jobs = Job::whereHas('skills', function ($query) use($skill) {
                 $query->where('skill_id', $skill->id);
             })->whereHas('verifiedSkills', function ($query) use($skill) {
                 $query->where('verified_skill_id', $skill->verified_skill_id);
             }, '<', 1)->get();
             foreach ($jobs as $job) {
                 $job->verifiedSkills()->attach($skill->verified_skill_id);
             }
         }
     })->daily();
     $schedule->call(function () {
         Log::info('HH parsing started');
         $hhGrabber = $this->app['App\\Helpers\\HeadHunterGrabber'];
         $job = $this->app['App\\Models\\Job'];
         $parser = new Parser([$hhGrabber], $job);
         $parser->parse();
     })->daily();
 }
Exemplo n.º 2
0
 public function testJob_Is_Not_Find()
 {
     $this->fixture->shouldReceive('getJobByVacancyId')->with(2)->andReturn(\Mockery::self())->atLeast(1);
     $this->fixture->shouldReceive('extendJob')->andReturn(true)->atLeast(1);
     $parser = new Parser([], $this->fixture);
     $parser->parseVacancy(2, null);
 }
Exemplo n.º 3
0
 public static function getSubsection($serverid, $sectionid, $subsectionid)
 {
     $token = Session::get('user')->authentication_token;
     $servers = Helper::getPlexServers();
     if (!isset($servers[$serverid])) {
         return array();
     }
     $server = $servers[$serverid];
     $info = Cache::remember('plex_media_' . $serverid . $subsectionid . $token, env('CACHE_TIME', -1), function () use($token, $serverid, $subsectionid, $server) {
         $client = new GuzzleHttp\Client();
         $res = $client->request('GET', 'https://' . $server['host'] . ':' . $server['port'] . '/library/metadata/' . $subsectionid . '/children', ['headers' => ['X-Plex-Token' => $server['accessToken']], 'http_errors' => false, 'verify' => false]);
         $body = (string) $res->getBody();
         $body = Parser::xml($body);
         if (!isset($body['@attributes'])) {
             return array();
         }
         return $body;
     });
     return $info;
 }