/**
  * Returns the standardized job object
  *
  * @param array $payload
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload)
 {
     $job = new Job(['description' => $payload['Description'], 'title' => $payload['JobTitle'], 'name' => $payload['JobTitle'], 'url' => $payload['Url'], 'sourceId' => $payload['Id'], 'qualifications' => $payload['Requirements'], 'maximumSalaray' => $payload['SalaryMax'], 'minimumSalaray' => $payload['SalaryMin'], 'baseSalaray' => $payload['SalaryMin']]);
     $job->setDatePostedAsString($payload['PostDate']);
     $job = $this->setValidThroughAsString($payload['ExpireDate'], $job);
     $job = $this->setCategory($payload, $job);
     $job = $this->setCompany($payload, $job);
     return $this->setLocation($payload, $job);
 }
 /**
  * Returns the standardized job object
  *
  * @param array $payload Raw job payload from the API
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload = [])
 {
     $job = new Job(['description' => $payload['DescriptionTeaser'], 'employmentType' => $payload['EmploymentType'], 'title' => $payload['JobTitle'], 'name' => $payload['JobTitle'], 'url' => $payload['JobDetailsURL'], 'educationRequirements' => $payload['EducationRequired'], 'experienceRequirements' => $payload['ExperienceRequired'], 'sourceId' => $payload['DID']]);
     $pay = $this->parseSalariesFromString($payload['Pay']);
     $job->setOccupationalCategoryWithCodeAndTitle($payload['OnetCode'], $payload['ONetFriendlyTitle'])->setCompany($payload['Company'])->setCompanyUrl($payload['CompanyDetailsURL'])->setLocation($this->parseLocationElement($payload['City']) . ', ' . $this->parseLocationElement($payload['State']))->setCity($this->parseLocationElement($payload['City']))->setState($this->parseLocationElement($payload['State']))->setDatePostedAsString($payload['PostedDate'])->setCompanyLogo($payload['CompanyImageURL'])->setMinimumSalary($pay['min'])->setMaximumSalary($pay['max']);
     if (isset($payload['Skills']['Skill'])) {
         $job->setSkills($this->parseSkillSet($payload['Skills']['Skill']));
     }
     return $job;
 }
 /**
  * Attempt to parse and add location to Job
  *
  * @param Job     $job
  * @param string  $location
  *
  * @return  Job
  */
 private function setJobLocation(Job $job, $location)
 {
     $location = static::parseLocation($location);
     if (isset($location[0])) {
         $job->setCity($location[0]);
     }
     if (isset($location[1])) {
         $job->setState($location[1]);
     }
     return $job;
 }
 /**
  * Sets city and state from single field on job
  *
  * @param Job $job Job object
  *
  * @return Job
  */
 public function setCityStateLocation($job)
 {
     if (isset($job->location)) {
         $locationArray = static::parseLocation($job->location);
         if (isset($locationArray[0])) {
             $job->setCity($locationArray[0]);
         }
         if (isset($locationArray[1])) {
             $job->setState($locationArray[1]);
         }
     }
     return $job;
 }
 /**
  * Returns the standardized job object
  *
  * @param array $payload
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload)
 {
     $job = new Job(['sourceId' => $payload['id'], 'title' => $payload['position_title'], 'name' => $payload['position_title'], 'url' => $payload['url'], 'location' => $payload['location'], 'maximumSalary' => $payload['maximum'], 'startDate' => $payload['start_date'], 'endDate' => $payload['end_date']]);
     $location = static::parseLocation($payload['location']);
     $job->setCompany($payload['organization_name'])->setDatePostedAsString($payload['start_date'])->setMinimumSalary($payload['minimum']);
     if (isset($location[0])) {
         $job->setCity($location[0]);
     }
     if (isset($location[1])) {
         $job->setState($location[1]);
     }
     return $job;
 }
 /**
  * Returns the standardized job object
  *
  * @param array $payload
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload)
 {
     $job = new Job(['title' => $payload['jobTitle'], 'name' => $payload['jobTitle'], 'url' => $payload['detailUrl'], 'location' => $payload['location']]);
     $location = static::parseLocation($payload['location']);
     $job->setCompany($payload['company'])->setDatePostedAsString($payload['date']);
     if (isset($location[0])) {
         $job->setCity($location[0]);
     }
     if (isset($location[1])) {
         $job->setState($location[1]);
     }
     return $job;
 }
 /**
  * Returns the standardized job object
  *
  * @param array $payload
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload)
 {
     $job = new Job(['title' => $payload['name'], 'name' => $payload['name'], 'description' => $payload['snippet'], 'url' => $payload['url'], 'sourceId' => $payload['id'], 'location' => $payload['location']]);
     $job->setCompany($payload['hiring_company']['name'])->setCompanyUrl($payload['hiring_company']['url'])->setDatePostedAsString($payload['posted_time'])->setCity($payload['city'])->setState($payload['state']);
     return $job;
 }
 /**
  * Returns the standardized job object
  *
  * @param array $payload
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload)
 {
     $job = new Job(['title' => $payload['title'], 'name' => $payload['title'], 'description' => $payload['description'], 'url' => $payload['link'], 'sourceId' => $payload['guid'], 'javascriptAction' => 'onclick', 'javascriptFunction' => $payload['onclick'], 'location' => $payload['city'] . ', ' . $payload['state']]);
     $job->setCompany($payload['company'])->setState($payload['state'])->setCity($payload['city'])->setDatePostedAsString($payload['postdate']);
     return $job;
 }
 /**
  * Returns the standardized job object
  *
  * @param array|object $payload
  *
  * @return \JobApis\Jobs\Client\Job
  */
 public function createJobObject($payload)
 {
     $job = new Job(['title' => $payload['name'], 'name' => $payload['name'], 'description' => $payload['snippet'], 'url' => $payload['url'], 'sourceId' => $payload['id']]);
     return $job->setCompany($payload['company'])->setDatePostedAsString($payload['date']);
 }
Exemple #10
0
 public function testItCanBeRepresentedAsArray()
 {
     $attributes = $this->getJobAttributes();
     $address = new PostalAddress();
     $hiringOrg = new Organization();
     $jobLocation = new Place();
     $geoCoordinates = new GeoCoordinates();
     $hiringOrg->setAddress($address);
     $jobLocation->setAddress($address);
     $job = new Job($attributes);
     $jobArray = $job->setHiringOrganization($hiringOrg)->setJobLocation($jobLocation)->toArray();
     array_walk_recursive($attributes, function ($value, $key) use($jobArray) {
         $this->assertEquals($jobArray[$key], $value);
     });
     $this->assertEquals($hiringOrg->toArray(), $jobArray['hiringOrganization']);
     $this->assertEquals($address->toArray(), $jobArray['hiringOrganization']['address']);
     $this->assertEquals($jobLocation->toArray(), $jobArray['jobLocation']);
     $this->assertEquals($address->toArray(), $jobArray['jobLocation']['address']);
 }