This is the completed coding challenge for the outdoorsy staff engineer backend role.
The rental api has the following functionality:
/rentals/<RENTAL_ID>
Read one rental endpoint/rentals
Read many (list) rentals endpoint- Supported query parameters
- price_min (number)
- price_max (number)
- limit (number)
- offset (number)
- ids (comma separated list of rental ids)
- near (comma separated pair [lat,lng])
- sort (string)
- Examples:
rentals?price_min=9000&price_max=75000
rentals?limit=3&offset=6
rentals?ids=3,4,5
rentals?near=33.64,-117.93
// within 100 milesrentals?sort=price
rentals?near=33.64,-117.93&price_min=9000&price_max=75000&limit=3&offset=6&sort=price
- Supported query parameters
The rental object JSON in the response is as follows:
{
"id": "int",
"name": "string",
"description": "string",
"type": "string",
"make": "string",
"model": "string",
"year": "int",
"length": "decimal",
"sleeps": "int",
"primary_image_url": "string",
"price": {
"day": "int"
},
"location": {
"city": "string",
"state": "string",
"zip": "string",
"country": "string",
"lat": "decimal",
"lng": "decimal"
},
"user": {
"id": "int",
"first_name": "string",
"last_name": "string"
}
}
- make sure you have docker installed
- run command
docker compose up --build
will build latest code and bootstrap the api - test using the
http://localhost:8080/rentals/<id>
andhttp://localhost:8080/rentals/?<query_string>
endpoints (e.g.GET http://localhost:8080/rentals?ids=1,2,3&sort=lng&price_min=1&price_max=100000&limit=100&offset=1
)