Ruby on Rails project for a version of the game Rock Paper Scissors aka Rochambeau
- The application should allow a user to choose 'rock', 'paper', or 'scissors'
- The application make a request to a external api to retrieve the server’s throw.
- If the external does not work, an alternative is generated by this app.
- The application should responds with a JSON response indicating whether the user won, lost or tied
- Rock beats scissors
- Scissors beats paper
- Paper beats rock
- Identical throws tie (rock == rock, etc.)
-
install ruby v3.0.4. Check rbenv for more info
-
install the required gems. Do this at the app directory:
$ bundler
- serve the API:
$ rails s
- Do a POST HTTP request to the API endpoint and send your throw as a body, for example:
curl -v -H 'Content-Type: application/json' -X POST "http://localhost:3000/api/rps" -d '{"player_throw": {"throw":"rock"}}'
Ruby 3.0.4 Rails 7.0.4
Current version: 1.0.0
The changelog can be found here.