Implemented files
- The controller
app/Http/Controllers/Api/RomanController.php
- The model
app/Roman.php
- The roman table migration
database/migrations/2016_10_16_221936_create_roman_table.php
- The Abstract conversion class
app/Services/AbstractNumberConversion.php
- The integer to roman conversion class
app/Services/RomanConversionService.php
- Fractal Roman model trasformer
app/Transformers/RomanTransformer.php
- The phpunit test file
tests/RomanConversionTest.php
- The Roman model fatory
database/factories/RomanFactory.php
POST http://localhost:8000/api/roman
$ curl http://localhost:8000/api/roman \
-H "Content-Type: application/x-www-form-urlencoded" \
-d number=19
{
"data":
{
"id":1,
"number":"19",
"result":"XIX",
"created_at":"2016-10-17 10:11:06"
}
}
GET http://localhost:8000/api/roman
$ curl http://localhost:8000/api/roman
{
"data":
[
{
"id":1,
"number":19,
"result":"XIX",
"created_at":"2016-10-17 10:11:06"
}
],
"meta":
{
"pagination":
{
"total":1,
"count":1,
"per_page":10,
"current_page":1,
"total_pages":1,
"links":[]
}
}
}
GET http://localhost:8000/api/roman/top
$ curl http://localhost:8000/api/roman/top
{
"data":
[
{
"id":1,
"number":19,
"result":"XIX",
"created_at":"2016-10-17 10:11:06"
}
]
}