Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
Added example files
  • Loading branch information
Davis M authored and briedis committed Jul 11, 2018
1 parent 65e1afc commit 0d98435
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 97 deletions.
33 changes: 33 additions & 0 deletions examples/addCandidateWithFiles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use \Briedis\Breezy\Breezy;
use \Briedis\Breezy\Structures\CandidateItem;

// Create a regular breezy class, that does not use caching, always calls API
$breezy = new Breezy();

// Set credentials (Company ID can be retrieved from API (http://developer.breezy.hr/docs/userdetails))
$email = 'your@email';
$password = '*********';
$companyId = '000000000';
$positionId = '000000000';

// Sign in before every consecutive request
$breezy->signIn($email, $password);

// Create candidate
$candidate = new CandidateItem;
$candidate->name = 'John Doe';
$candidate->origin = CandidateItem::ORIGIN_SOURCED;
$candidate->summary = 'This is a new candidate.';
$candidate->phone_number = '21234567';
$candidate->email_address = '[email protected]';

// Add candidate
$newCandidate = $breezy->addCandidate($companyId, $positionId, $candidate);

// Upload candidate resume file
$resume = $breezy->uploadResume($companyId, $positionId, $newCandidate->id, '/path/to/resume.pdf', 'my-resume.pdf');

// Upload candidate other documents
$document = $breezy->uploadDocument($companyId, $positionId, $newCandidate->id, '/path/to/document.pdf', 'my-document.pdf');
32 changes: 32 additions & 0 deletions examples/addPosition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use \Briedis\Breezy\Breezy;
use \Briedis\Breezy\Structures\PositionItem;

// Create a regular breezy class, that does not use caching, always calls API
$breezy = new Breezy();

// Set credentials (Company ID can be retrieved from API (http://developer.breezy.hr/docs/userdetails))
$email = 'your@email';
$password = '*********';
$companyId = '000000000';

// Sign in before every consecutive request
$breezy->signIn($email, $password);

// Create position
$position = new PositionItem;
$position->name = 'Web Developer';
$position->description = 'This is a developer';
$position->state = PositionItem::STATE_DRAFT;
$position->location = [
'country' => 'LV',
'city' => 'Riga',
];
$position->type = PositionItem::TYPE_OTHER;
$position->category = PositionItem::CATEGORY_OTHER;
$position->education = PositionItem::EDUCATION_UNSPECIFIED;
$position->experience = PositionItem::EXPERIENCE_NA;

// Add position
$newPosition = $breezy->createPosition($companyId, $position);
21 changes: 21 additions & 0 deletions examples/customCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use \Briedis\Breezy\CacheAdapterInterface;

class CustomCacheDriver implements CacheAdapterInterface
{
public function get($key)
{
return null; // TODO implement
}

public function set($key, $value, $durationInSeconds)
{
// TODO implement
}

public function forget($key)
{
// TODO implement
}
}
25 changes: 25 additions & 0 deletions examples/getCurrentPositions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use \Briedis\Breezy\Breezy;
use \Briedis\Breezy\BreezyCached;

// Create a regular breezy class, that does not use caching, always calls API
$breezy = new Breezy();

// To use cached version
$breezy = new BreezyCached(new CustomCacheDriver);

// Set credentials (Company ID can be retrieved from API (http://developer.breezy.hr/docs/userdetails))
$email = 'your@email';
$password = '*********';
$companyId = '000000000';

// Sign in before every consecutive request
$breezy->signIn($email, $password);

// Getting current positions
$positions = $breezy->getCompanyPositions($companyId);

foreach ($positions as $position) {
echo $position->name;
}
102 changes: 5 additions & 97 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,102 +8,10 @@ Installation using Composer:
`composer require briedis/breezy --no-dev`

# Usage examples
```
<?php
/*
* Create a cached class (works faster, caches some of the API requests)
*/
$breezy = new \Briedis\Breezy\BreezyCached(new CustomCacheDriver);

See /examples/ folder:

/*
* Create a regular breezy class, that does not use caching, always calls API
*/
$breezy = new \Briedis\Breezy\Breezy();
/*
* Set credentials (Company ID can be retrieved from API (http://developer.breezy.hr/docs/userdetails))
*/
$email = 'your@email';
$password = '*********';
$companyId = '000000000';
/*
* Sign in before every consecutive request
*/
$breezy->signIn($email, $password);
/*
* Get data about company (description, logo, etc)
*/
$company = $breezy->getCompany($companyId);
echo $company->name;
echo $company->description;
echo '<img src="' . htmlspecialchars($company->logo) . '">';
/*
* Getting current positions
*/
foreach ($breezy->getCompanyPositions($companyId) as $v) {
echo $v->name;
}
/*
* Adding a candidate
*/
// Upload a resume
$resume = $breezy->uploadResume($companyId, '/path/to/resume.pdf', 'my-resume.pdf');
// Set candidate data
$candidate = new \Briedis\Breezy\Structures\CandidateItem;
$candidate->name = 'Candidate Name';
$candidate->phone_number = '1234567890';
$candidate->email_address = 'candidate@email';
// Create the candidate (resume is optional)
$createdCandidate = $breezy->addCandidate($companyId, candidate, $resume);
/*
* Adding a position
*/
$position = new \Briedis\Breezy\Structures\PositionItem;
$position->name = 'Position name';
$position->description = '<h1>Description</h1>';
$position->state = \Briedis\Breezy\Structures\PositionItem::STATE_PUBLISHED;
$breezy->createPosition($companyId, $position);
/*
* Implement your own caching class if you want to use the cached driver
*/
class CustomCacheDriver implements Briedis\Breezy\CacheAdapterInterface
{
public function get($key)
{
return null; // TODO implement
}
public function set($key, $value, $durationInSeconds)
{
// TODO implement
}
public function forget($key)
{
// TODO implement
}
}
```
* addCandidateWithFiles.php - Add candidate, with resume and other files
* addPosition.php - Add new position
* customCache.php - Implement your own caching class if you want to use the cached driver
* getCurrentPositions.php - Example of getting company positions

0 comments on commit 0d98435

Please sign in to comment.