https://github.com/sirius248/simple_boggle_api
https://github.com/sirius248/simple_boggle_api
ruby ruby-on-rails
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sirius248/simple_boggle_api
- Owner: sirius248
- Created: 2017-09-21T17:15:19.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-22T09:56:15.000Z (almost 9 years ago)
- Last Synced: 2025-02-04T15:28:28.236Z (over 1 year ago)
- Topics: ruby, ruby-on-rails
- Language: Ruby
- Homepage: https://simple-boggle-api.herokuapp.com
- Size: 225 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Boggle API
[](https://codeclimate.com/github/kimquy/simple_boggle_api)
[](https://travis-ci.org/kimquy/simple_boggle_api)
## Main files
```ruby
# The main implementation will be inside the following files
app/controllers/boggles_controller.rb
app/models/boggle.rb
app/models/node.rb
app/services/board_factory.rb
app/services/boggle_checker.rb
app/services/boggle_finder.rb
app/services/null_boggle.rb
app/services/play_boggle.rb
lib/boggle_dictionary.rb
db/migration
config/routes.rb
# All the unit tests inside the following folder
spec/
```
## API
```ruby
# Create new boggle
POST /boggles
{
data: "T, A, P, *, E, A, K, S, O, B, R, S, S, *, X, D"
}
# Query current boggle board
GET /boggles/current_board
# Check if a word in current boggle board
GET /boggles/check
{
query: 'tap'
}
# Get all found words for current board
GET /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
```ruby
# Test if a word in current board
curl -H "Content-Type: application/json" -X GET -d '{"query":"tap"}' https://simple-boggle-api.herokuapp.com/boggles/check
# Get the current board
curl -H "Content-Type: application/json" -X GET https://simple-boggle-api.herokuapp.com/boggles/current_board
# Create new boggle
curl -H "Content-Type: application/json" -X POST -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 board
curl -H "Content-Type: application/json" -X GET https://simple-boggle-api.herokuapp.com/boggles/found_words
# Play game
curl -H "Content-Type: application/json" -X GET -d '{"timer":"5"}' https://simple-boggle-api.herokuapp.com/boggles/play_game
```
## Unit tests
```ruby
bundle exec rspec
```
## 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.
## Screenshots



