Skip to content

Commit

Permalink
Base library lib allows setting the auth token.
Browse files Browse the repository at this point in the history
Reformat
  • Loading branch information
briedis committed Aug 21, 2018
1 parent 5ec3cfe commit 8db811e
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions src/Breezy.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ public function signIn($email, $password)
return $token;
}

/**
* Set authorization token for next requests
* @param string $token
*/
public function setToken($token)
{
$this->api->setToken($token);
}

/**
* Get company data
* @param string $companyId
* @return CompanyItem
* @throws BreezyException
*/
public function getCompany($companyId)
{
Expand All @@ -59,6 +69,7 @@ public function getCompany($companyId)
* @param string $companyId
* @param string $state State of the position (draft, archived, etc). By default, returns only published. Pass an empty string if you want all
* @return PositionItem[]
* @throws BreezyException
*/
public function getCompanyPositions($companyId, $state = PositionItem::STATE_PUBLISHED)
{
Expand All @@ -85,6 +96,7 @@ public function getCompanyPositions($companyId, $state = PositionItem::STATE_PUB
* @param string $positionId
* @param string $candidateId
* @return CandidateItem
* @throws BreezyException
*/
public function getCandidate($companyId, $positionId, $candidateId)
{
Expand All @@ -101,6 +113,7 @@ public function getCandidate($companyId, $positionId, $candidateId)
* @param string $positionId
* @param CandidateItem $candidate
* @return CandidateItem
* @throws BreezyException
*/
public function addCandidate($companyId, $positionId, CandidateItem $candidate)
{
Expand All @@ -124,10 +137,17 @@ public function uploadResume($companyId, $positionId, $candidateId, $pathname, $
$extension = pathinfo($filename, PATHINFO_EXTENSION);

if (!in_array($extension, self::$allowedFileExtensions, true)) {
throw new BreezyException('Extension "' . $extension . '" is not within allowed list: ' . implode(', ', self::$allowedFileExtensions));
throw new BreezyException(
'Extension "' . $extension . '" is not within allowed list: '
. implode(', ', self::$allowedFileExtensions)
);
}

$response = $this->api->uploadFile('company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/resume', $pathname, $filename);
$response = $this->api->uploadFile(
'company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/resume',
$pathname,
$filename
);

return $response;
}
Expand All @@ -147,10 +167,17 @@ public function uploadDocument($companyId, $positionId, $candidateId, $pathname,
$extension = pathinfo($filename, PATHINFO_EXTENSION);

if (!in_array($extension, self::$allowedFileExtensions, true)) {
throw new BreezyException('Extension "' . $extension . '" is not within allowed list: ' . implode(', ', self::$allowedFileExtensions));
throw new BreezyException(
'Extension "' . $extension . '" is not within allowed list: '
. implode(', ', self::$allowedFileExtensions)
);
}

$response = $this->api->uploadFile('company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/documents', $pathname, $filename);
$response = $this->api->uploadFile(
'company/' . $companyId . '/position/' . $positionId . '/candidate/' . $candidateId . '/documents',
$pathname,
$filename
);

return $response;
}
Expand Down

0 comments on commit 8db811e

Please sign in to comment.