Beispiel #1
0
 /**
  * @param \stdClass $apiJob
  * @param           $country
  *
  * @return Job
  * @throws CareerjetException
  */
 public static function fromApi(\stdClass $apiJob, string $country) : Job
 {
     self::validateJob($apiJob);
     $job = new Job();
     $job->setTitle($apiJob->title);
     $job->setDate(new \DateTime($apiJob->date));
     $job->setSnippet($apiJob->description);
     $job->setViewUrl($apiJob->url);
     if (isset($apiJob->salary_currency_code)) {
         $job->setSalaryCurrencyCode($apiJob->salary_currency_code);
     }
     if (isset($apiJob->salary_min)) {
         $job->setSalaryMin($apiJob->salary_min);
     }
     if (isset($apiJob->salary_max)) {
         $job->setSalaryMax($apiJob->salary_max);
     }
     $job->setCountry($country);
     switch ($country) {
         case 'Brazil':
             $job = JobWithBrazilianLocationsBuilder::fromApi($apiJob, $job);
             break;
         default:
             break;
     }
     $job->setSource($apiJob->site);
     if (!empty($apiJob->company)) {
         $job->setCompany($apiJob->company);
     }
     return $job;
 }
Beispiel #2
0
 public function setUp()
 {
     $this->job = new Job();
     $this->job->setKey('job_key');
     $this->job->setIndex(new Index('index_key', 'Index Name', 'http://index.url', 'affId'));
     $this->job->setTitle('Analista de Sistema para Software de RH');
     $this->job->setCompany('Mega Enterprise, Co');
     $this->job->setSalaryCurrencyCode('BRL');
     $this->job->setSalaryMin(1000);
     $this->job->setSalaryMax(2000);
     $this->job->setCity('Sao Paulo');
     $this->job->setState('SP');
     $this->job->setCountry('Brasil');
     $this->job->setSource('www.ceviu.com.br');
     $this->job->setDate(new \DateTime('Sat, 13 Feb 2016 08:59:39 GMT'));
     $this->job->setSnippet('Principais atribuições do cargo...');
     $this->job->setDescription('Descrição detalhada do cargo...');
     $this->job->setViewUrl('http://job.url/pt-br/job-12345');
     $this->job->setApplyUrl('http://job.url/pt-br/apply-12345');
     $this->job->setFeatured(false);
 }