diff --git a/src/API/Entities.php b/src/API/Entities.php new file mode 100644 index 0000000..6b28b3b --- /dev/null +++ b/src/API/Entities.php @@ -0,0 +1,46 @@ + + * + * 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 + */ +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}"); + } +} diff --git a/tests/API/EntitiesTest.php b/tests/API/EntitiesTest.php new file mode 100644 index 0000000..55d89fe --- /dev/null +++ b/tests/API/EntitiesTest.php @@ -0,0 +1,41 @@ + + * + * 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 + * @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'); + }); + } +}