-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Translations
as a resource name and be able to specify the apiB…
…aseUrl (#483) * added translation as a resource for httpClient and updated apiBasePath to accept a different value other than the hard-coded one (api/v2)
- Loading branch information
Showing
3 changed files
with
63 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Zendesk\API\Resources\Core; | ||
|
||
use Zendesk\API\Resources\ResourceAbstract; | ||
use Zendesk\API\Traits\Resource\FindAll; | ||
|
||
/** | ||
* The Translations class finds the manifest files for localizations | ||
*/ | ||
|
||
class Translations extends ResourceAbstract | ||
{ | ||
use FindAll; | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUpRoutes() | ||
{ | ||
$this->setRoutes([ | ||
'manifest' => "{$this->resourceName}/manifest.json", | ||
]); | ||
} | ||
|
||
/** | ||
* Get the manifest json file | ||
* | ||
* @param array $params | ||
* | ||
* @throws \Exception | ||
* | ||
* @return \stdClass | null | ||
*/ | ||
public function manifest(array $params = []) | ||
{ | ||
return $this->findAll($params, __FUNCTION__); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Zendesk\API\UnitTests\Core; | ||
|
||
use Zendesk\API\UnitTests\BasicTest; | ||
|
||
/** | ||
* Translations test class | ||
*/ | ||
class TranslationsTest extends BasicTest | ||
{ | ||
/** | ||
* Test manifest method | ||
*/ | ||
public function testFindManifest() | ||
{ | ||
$this->assertEndpointCalled(function () { | ||
$this->client->translations()->manifest(); | ||
}, 'translations/slack-auth-service/manifest.json'); | ||
} | ||
} |