/** * @param $base64Resume * @param $fileName * @return \SimpleXMLElement */ public function parse($base64Resume, $fileName) { // Seems that the parse has better results with text files $fileName = str_replace('.html', '.txt', $fileName); $result = $this->client->post('/candidate/parse/', array('base64stream' => $base64Resume, 'fileName' => $fileName)); return $result; }
/** * TODO: should rely on an API key, etc * For now we just test if the user exists in the target system * There's no API endpoint for that, so we get the list of users and search for ours... * @param $username * @return bool */ public function authenticate($username) { $result = $this->client->get('/ref/user/'); $userFound = false; foreach ($result->result->item as $user) { if ($user->username == $username) { $userFound = true; } } return $userFound; }
/** * @param $data * @param $url * @param $resume * @param $filename * @return \SimpleXMLElement */ public function execute($data, $url, $resume, $filename) { $transaction = $this->client->beginTrans(); $transaction->post('/candidate/', $this->prepareCandidate($data)); foreach ($this->prepareExperiences($data) as $index => $experience) { // avoid "too many employment items error" if ($index == 3) { break; } $transaction->post('/candidate/queued/employment/', $experience); } $transaction->post('/candidate/queued/attachment/', array('fileName' => $filename, 'base64stream' => $resume, 'type' => 1)); $result = $transaction->commit(); return $result; }
/** * @param $pathInfo * @param array $params * @return \SimpleXMLElement */ public function post($pathInfo, array $params = array()) { $params['queueid'] = $this->id; return $this->client->post($pathInfo, $params); }