Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efbb59e
commit 1d565c6
Showing
2 changed files
with
87 additions
and
0 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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Ark PHP Client. | ||
* | ||
* (c) Ark Ecosystem <info@ark.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace ArkEcosystem\Client\API; | ||
|
||
/** | ||
* This is the entities resource class. | ||
* | ||
* @author Brian Faust <brian@ark.io> | ||
*/ | ||
class Entities extends AbstractAPI | ||
{ | ||
/** | ||
* Get all entities. | ||
* | ||
* @param array $query | ||
* | ||
* @return array | ||
*/ | ||
public function all(array $query = []): ?array | ||
{ | ||
return $this->get('entities', $query); | ||
} | ||
|
||
/** | ||
* Get an entity by the given id. | ||
* | ||
* @param string $id | ||
* | ||
* @return array | ||
*/ | ||
public function show(string $id): ?array | ||
{ | ||
return $this->get("entities/{$id}"); | ||
} | ||
} |
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,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Ark PHP Client. | ||
* | ||
* (c) Ark Ecosystem <info@ark.io> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace ArkEcosystem\Tests\Client\API; | ||
|
||
use ArkEcosystem\Tests\Client\TestCase; | ||
|
||
/** | ||
* This is the entities resource test class. | ||
* | ||
* @author Brian Faust <brian@ark.io> | ||
* @covers \ArkEcosystem\Client\API\Entities | ||
*/ | ||
class EntitiesTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function all_calls_correct_url() | ||
{ | ||
$this->assertResponse('GET', 'entities', function ($connection) { | ||
return $connection->entities()->all(); | ||
}); | ||
} | ||
|
||
/** @test */ | ||
public function show_calls_correct_url() | ||
{ | ||
$this->assertResponse('GET', 'entities/dummy', function ($connection) { | ||
return $connection->entities()->show('dummy'); | ||
}); | ||
} | ||
} |