
Service that navigates an imaginary robotic hoover through an imaginary room, built with Laravel for routing, application code and testing.
https://github.com/davidgrayston/room-service
/api/room/hoover endpoint is handled by the controller. The classes that deal with moving the hoover around the room can be found in the App\RoomService namespace.
All request inputs/outputs are logged using the ApiRequest model.
The log can be viewed at http://localhost:8080/log
Tests can be found in the tests directory.
Docker has been used to containerise the application.
$json_data = [
'roomSize' => [5, 5],
'coords' => [1, 2],
'patches' => [
[1, 0],
[2, 2],
[2, 3],
],
'instructions' => 'NNESEESWNWW',
];
$client = new GuzzleHttp\Client(['base_uri' => 'http://localhost:8080/api/']);
$response = $client->request('POST', 'room/hoover', [
'json' => $json_data,
'headers' => [
'Accept' => 'application/json'
]
]);
echo $response->getBody();
curl -X POST "http://localhost:8080/api/room/hoover" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"roomSize\":[5,5],\"coords\":[1,2],\"patches\":[[1,0],[2,2],[2,3]],\"instructions\":\"NNESEESWNWW\"}"