Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laertispappas/bowling
https://github.com/laertispappas/bowling
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/laertispappas/bowling
- Owner: laertispappas
- Created: 2018-10-27T16:34:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-28T15:23:51.000Z (about 6 years ago)
- Last Synced: 2024-10-30T21:26:51.127Z (2 months ago)
- Language: Ruby
- Size: 91.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bowling
## Prerequisites
* [Docker Compose](https://docs.docker.com/compose/install/)
Navigate to root directory (`bowling`) and run:
* `docker-compose up --build` This will run a postgresql db and the api as docker containers
## Api
1. Create a game: `curl localhost:3000/api/v1/games -H "Content-Type: application/json" -d '{"users": [{"name": "LP"}]}'`
2. Get game details: `curl localhost:3000/api/v1/games/:GAME_ID` retrieved from step 1
3. Make a roll for a user: `curl localhost:3000/api/v1/games/:GAME_ID/players/:player_id/frames/:FRAME_ID/roll -H "Content-Type: application/json" -d '{"pins": 3}'`. Game id, current player turn and current frame id are retrieved from step 1 or 2.## Caching
Api uses http caching for `/api/v1/games/:id endpoint`.
Usage:1. Make the first request for a game: `curl -i http://localhost:3000/api/v1/games/3`. HTTP status: 200
2. Get `ETag` value from response headers and pass it to the next requests: `curl -i http://localhost:3000/api/v1/games/3 -H 'If-None-Match: W/"ebfe4df560297a5dcc1f7800ca5ce851"'`. HTTP status: 304
3. When a a game is updated (a new roll takes place) the next GET request should respond with the updated JSON payload.## Run tests
* `docker-compose run web bundle exec rspec spec`