Skip to content

Commit

Permalink
Merge pull request #197 from zendesk/jsmale/external_id
Browse files Browse the repository at this point in the history
Whitelist external_id as an accepted query param
  • Loading branch information
Jason Smale committed Sep 4, 2015
2 parents 6915c78 + 5a317ae commit 04e31fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Zendesk/API/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function prepareQueryParams(array $sideload = null, array $iterato
// Next look for special collection iterators
if (is_array($iterators)) {
foreach ($iterators as $k => $v) {
if (in_array($k, ['per_page', 'page', 'sort_order', 'sort_by'])) {
if (in_array($k, ['per_page', 'page', 'sort_order', 'sort_by', 'external_id'])) {
$addParams[$k] = $v;
}
}
Expand Down
11 changes: 11 additions & 0 deletions tests/Zendesk/API/UnitTests/Core/UsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ public function testSearch()
}, 'users/search.json', 'GET', ['queryParams' => $queryParams]);
}

/**
* Tests if the search enpoint can be called by the client and is passed the correct external_id
*/
public function testSearchByExternalId()
{
$queryParams = ['external_id' => 'ext-1'];
$this->assertEndpointCalled(function () use ($queryParams) {
$this->client->users()->search($queryParams);
}, 'users/search.json', 'GET', ['queryParams' => $queryParams]);
}

/*
* Needs an existed User with specified query 'name' keyword to run this function
*/
Expand Down

0 comments on commit 04e31fb

Please sign in to comment.