sirius248 / simple_boggle_api

Home Page:https://simple-boggle-api.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Boggle API

Code Climate

Build Status

Main files

# 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

# 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

# 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

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

0

1

2

3

About

https://simple-boggle-api.herokuapp.com


Languages

Language:Ruby 99.4%Language:HTML 0.6%