https://serene-reaches-07094.herokuapp.com/
- Koroibos was a solo project completed within a 48-hour timeframe to mock a technical take home challenge
- The purpose was to build a tested RESTful API with Olympian data imported from a CSV that exposes 6 endpoints that analyzes the data
- Ruby on Rails
- ActiveRecord
- PostgreSQL
- Fast JSON API
- RSpec
- SimpleCOV
- Clone the GitHub repository
- Go to the directory with the new repo
- Run
bundle install
- Setup database:
a) Run
rails db:{create,migrate}
b) Import data withrails import:csv
- To run the server:
rails s
- Run
rspec
- To run a single test file:
rspec <test directory>
- To generate coverage report:
open coverage/index.html
Request:
GET /api/v1/olympians
Response Example:
status: 200
{
"data": [
{
"id": "1",
"type": "olympian",
"attributes": {
"name": "Andreea Aanei",
"age": 22,
"sport": "Weightlifting",
"team": "Romania",
"total_medals_won": 0
}
},
{
"id": "2",
"type": "olympian",
"attributes": {
"name": "Nstor Abad Sanjun",
"age": 23,
"sport": "Gymnastics",
"team": "Spain",
"total_medals_won": 0
}
},
{...}
]
}
Request:
GET /api/v1/olympians?age=youngest
Response Example:
status: 200
{
"data": {
"id": "2190",
"type": "olympian",
"attributes": {
"name": "Ana Iulia Dascl",
"age": 13,
"sport": "Swimming",
"team": "Romania",
"total_medals_won": 0
}
}
}
Request:
GET /api/v1/olympians?age=oldest
Response Example:
status: 200
{
"data": {
"id": "1321",
"type": "olympian",
"attributes": {
"name": "Julie Brougham",
"age": 62,
"sport": "Equestrianism",
"team": "New Zealand",
"total_medals_won": 0
}
}
}
Request:
GET /api/v1/olympian_stats
Response Example:
status: 200
{
"data": {
"id": null,
"type": "olympian_stats",
"attributes": {
"total_competing_olympians": 2850,
"average_weight": {
"unit": "kg",
"male_olympians": 77.9,
"female_olympians": 61.4
},
"average_age": 26.4
}
}
}
Request:
GET /api/v1/events
Response Example:
status: 200
{
"data": [
{
"id": "1",
"type": "sport",
"attributes": {
"name": "Weightlifting",
"events": [
"Weightlifting Women's Super-Heavyweight",
"Weightlifting Men's Heavyweight",
"Weightlifting Men's Middleweight",
"Weightlifting Men's Middle-Heavyweight",
"Weightlifting Men's Featherweight",
"Weightlifting Women's Flyweight",
"Weightlifting Women's Middleweight",
"Weightlifting Women's Lightweight",
"Weightlifting Men's Lightweight",
"Weightlifting Men's Super-Heavyweight",
"Weightlifting Men's Light-Heavyweight",
"Weightlifting Women's Heavyweight",
"Weightlifting Women's Light-Heavyweight",
"Weightlifting Men's Bantamweight",
"Weightlifting Women's Featherweight"
]
}
},
{...}
]
}
Request:
GET /api/v1/events/:id/medalists
Response Example:
status: 200
{
"data": {
"id": null,
"type": "event_medalist",
"attributes": {
"event": "Rowing Men's Coxless Pairs",
"medalists": [
{
"name": "Giovanni Abagnale",
"team": "Italy",
"age": 21,
"medal": "Bronze"
},
{
"name": "Hamish Byron Bond",
"team": "New Zealand",
"age": 30,
"medal": "Gold"
},
{
"name": "Lawrence Brittain",
"team": "South Africa",
"age": 25,
"medal": "Silver"
},
{
"name": "Marco Di Costanzo",
"team": "Italy",
"age": 24,
"medal": "Bronze"
}
]
}
}
}