This repository opens up API for
- starting a new bowling game which returns
game_id
- recording ball throws with
pinfall_count
andgame_id
as parameters - api to return current game
state
andscore
-
Ruby version - ruby-2.6.3
-
Configuration - Rails 6.0.2 --api --postgresql
-
configure your database.yml for postgresql rake db:create rake db:migrate
-
Enpoints:
- Start New Game -
POST /games
{ "status": "success", "message": "New game started", "game_id": 37 }
- Add a Throw -
POST /games/:game_id/throws
accepts params{ knocked_pins: 1 }
{ "status": "success", "message": "Throw recorded successfully.", "knocked_pins": 1 }
- Get Game Score & Status -
GET /games/:id
-
"status": "success", "game": { "state": "open", "score": 6, "score_details": { "frames": [ { "score": 6, "state": "closed", "throws": [ { "knocked_pins": 1, "knock_type": "play" }, { "knocked_pins": 5, "knock_type": "play" } ] }, { "score": null, "state": "closed", "throws": [ { "knocked_pins": 5, "knock_type": "play" }, { "knocked_pins": 5, "knock_type": "spare" } ] } ] } } }```