Skip to content

Commit

Permalink
Merge pull request #35 from yoavmatchulsky/add_new_candidate_tag
Browse files Browse the repository at this point in the history
Add New Cadidate Tag
  • Loading branch information
tdphillipsjr authored Jun 17, 2021
2 parents 764ca36 + 378acdf commit 17e2819
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Some method calls and URLs do not fit this format, but the methods were named as
* `postUnrejectApplication`: [Unreject an application](https://developers.greenhouse.io/harvest.html#post-unreject-application)
* `postMergeCandidates`: [Merge a duplicate candidate to a primary candidate.](https://developers.greenhouse.io/harvest.html#put-merge-candidates)
* `getCandidateTags`: [Returns all candidate tags in your organization.](https://developers.greenhouse.io/harvest.html#get-list-candidate-tags)
* `postCandidateTags`: [Create a new candidate tag in your organization.](https://developers.greenhouse.io/harvest.html#post-add-new-candidate-tag)
* `getTagsForCandidate`: [Returns all tags applied to a single candidate.](https://developers.greenhouse.io/harvest.html#get-list-tags-applied-to-candidate)
* `getCustomFields`: [Returns all custom fields](https://developers.greenhouse.io/harvest.html#get-list-custom-fields): Note for this method, the id argument will contain the type of custom field you want to retrieve. `$harvestService->getCustomFields(array('id' => 'job'));` will return all the job custom fields in your organization. Leaving this argument blank will return all custom fields.
* `getTrackingLinks`: [Return a specific traking link for the supplied token.](https://developers.greenhouse.io/harvest.html#get-tracking-link-data-for-token): Note for this link, the token will be provided in the 'id' argument. `$harvestService->getTrackingLink(array('id' => '<token>'));`
Expand Down
7 changes: 7 additions & 0 deletions src/Services/HarvestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,13 @@ public function getCandidateTags($parameters=array())
return $this->sendRequest();
}

public function postCandidateTags($parameters=array())
{
$this->_harvest = $this->_harvestHelper->parse('postCandidateTags', $parameters);
$this->_harvest['url'] = 'tags/candidate';
return $this->sendRequest();
}

public function patchEnableUser($parameters=array())
{
$this->_harvest = $this->_harvestHelper->parse('patchEnableUser', $parameters);
Expand Down
19 changes: 19 additions & 0 deletions tests/Services/HarvestServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,25 @@ public function testGetCandidateTags()
$this->assertEquals($this->expectedAuth, $this->harvestService->getAuthorizationHeader());
}

public function testPostCandidateTags()
{
$expected = array(
'method' => 'post',
'url' => 'tags/candidate',
'headers' => array('On-Behalf-Of' => 234),
'body' => '{"name":"Test Tag"}',
'parameters' => array()
);
$params = array(
'headers' => array('On-Behalf-Of' => 234),
'body' => '{"name":"Test Tag"}',
);

$this->harvestService->postCandidateTags($params);
$this->assertEquals($expected, $this->harvestService->getHarvest());
$this->assertEquals($this->expectedAuth, $this->harvestService->getAuthorizationHeader());
}

public function testGetTagsForCandidate()
{
$expected = array(
Expand Down

0 comments on commit 17e2819

Please sign in to comment.