# The main implementation will be inside the following filesapp/controllers/boggles_controller.rbapp/models/boggle.rbapp/models/node.rbapp/services/board_factory.rbapp/services/boggle_checker.rbapp/services/boggle_finder.rbapp/services/null_boggle.rbapp/services/play_boggle.rblib/boggle_dictionary.rbdb/migrationconfig/routes.rb# All the unit tests inside the following folderspec/
API
# Create new bogglePOST/boggles{ data: "T, A, P, *, E, A, K, S, O, B, R, S, S, *, X, D"}# Query current boggle boardGET /boggles/current_board# Check if a word in current boggle boardGET/boggles/check{query: 'tap'}# Get all found words for current boardGET/boggles/found_words# To Play a boggle game# The timer will be in second. If user don't pass the timer then the default will be 1 minutes. Or if the user pass timer more than 3 minutes then it will be 3 minutes.GET/boggle/play_game{timer: 5}
Test with Curl
# Test if a word in current boardcurl -H"Content-Type: application/json" -XGET -d'{"query":"tap"}'https://simple-boggle-api.herokuapp.com/boggles/check# Get the current boardcurl -H"Content-Type: application/json" -XGEThttps://simple-boggle-api.herokuapp.com/boggles/current_board# Create new bogglecurl -H"Content-Type: application/json" -XPOST -d'{"data":"T, A, P, *, E, A, K, S, O, B, R, S, S, *, X, D"}'https://simple-boggle-api.herokuapp.com/boggles# Get all found words for current boardcurl -H"Content-Type: application/json" -XGEThttps://simple-boggle-api.herokuapp.com/boggles/found_words# Play gamecurl -H"Content-Type: application/json" -XGET -d'{"timer":"5"}'https://simple-boggle-api.herokuapp.com/boggles/play_game
Unit tests
bundleexecrspec
Improvement
Clean up the algorithm for BoggleChecker
Add more meaningful test case
There're still many other thing can be improve. Such as: the API is very simple, or validation or check for bad data submit from user.