Plan your next game night with GameNight! With this app you can add games to your shelf, get your friends to do the same, and when it is time to plan a game night, leave the planning to us. We will get all the games collated and allow your party to vote on the game(s) you want to play before the game night!
This is the backend API that supports the Game Night application. You can find the Frontend of the application here, and checkout the microservice here.
This app is built on Rails 5.2 with support from:
- Faraday
- Fastjsonapi
- Figaro
- and a host of testing gems
To install and run this application locally:
- To setup the repository locally, clone it down and run the following commands:
$ bundle install
$ rails db:{create,migrate,seed}
-
Next, startup your server with the
$ rails server
command -
You should now be able to open your web browser, navigate to
http://localhost:3000/
and see the Rails default information page. -
From here, you are free to hit any of the api endpoints listed below. The URL should be prefixed with your localhost port like this
GET http://localhost:3000/api/v1/users/{user_id}/friends
-
To run our test suite, run
bundle exec rspec
in your terminal. As of 1/15/2021, this app is a 99.4% test coverage.
List all friends for a specific user.
GET /api/v1/users/{user_id}/friends
Default response
{
"data": [
{
"id": "2",
"type": "friends",
"attributes": {
"name": "Austin",
"email": "Austin@example.com"
}
},
{
"id": "3",
"type": "friends",
"attributes": {
"name": "Phil",
"email": "Phil@example.com"
}
}
]
}
Accept a friend request.
PATCH /api/v1/users/{user_id}/friends/{friends_user_id}
Send a friend request.
POST /api/v1/users/{user_id}/friends
Raw JSON request body. The email will need to belong to an existing user.
{
"friend_email": "joe@example.com"
}
Delete a game from a users shelf.
DELETE /api/v1/users/{user_id}/friends/{friends_user_id}
List all games for a specific user.
GET /api/v1/users/{user_id}/games
Default response
{
"data": [
{
"id": "2",
"type": "games",
"attributes": {
"name": "Pandemic",
"game_type": "Board/Strategy",
"description": "It is our life now",
"duration": 95,
"image": "IMAGE",
"num_players": "4",
"age_range": "15"
}
}
]
}
Add a game to a users shelf.
POST /api/v1/users/{user_id}/games
Raw JSON request body
{
"name": "Best Game Ever",
"description": "Yes, it is the best game",
"duration": 90,
"game_type": "Board/Strategy", // optional
"image": "www.hostingsite.com/yourimage", // optional
"num_players": "4-6", // optional
"age_range": "12+" // optional
}
Delete a game from a users shelf.
DELETE /api/v1/users/{user_id}/games/{game_id}
List all games nights a user is attending
GET /api/v1/users/{user_id}/game_nights
Default response
{
"data": [
{
"id": "1",
"type": "user_game_night",
"attributes": {
"name": "Test Game Night",
"date": "09-21-2021",
"number_of_games": 2
}
}
]
}
List all game night invitations for a user.
GET /api/v1/users/{user_id}/invitations
Default response
{
"data": [
{
"id": "1",
"type": "invitation",
"attributes": {
"id": 1,
"game_night": {
"game_night_id": 1,
"name": "Test Game Night",
"date": "09-21-2021",
"number_of_games": 2,
"host": "Kate",
"host_id": 1
}
}
}
]
}
Search for a game. This search will return 20 results based on the name parameter.
GET /api/v1/games/find
Parameter Type Description
name string The name of the game you want to search for
Default response
{
"data": [
{
"id": null,
"type": "board_game",
"attributes": {
"name": "Clue",
"description": "<p>The classic detective game! In <strong>Clue</strong>, players move from room to room in a mansion to solve the mystery of: who done it, with what, and where? Players are dealt character, weapon, and location cards after the top card from each card type is secretly placed in the confidential file in the middle of the board. Players must move to a room and then make an accusation against a character saying they did it in that room with a specific weapon. The player to the left must show one of any cards accused to the accuser if in that player's hand. Through deductive reasoning each player must figure out which character, weapon, and location are in the secret file. To do this, each player must uncover what cards are in other players hands by making more and more accusations. Once a player knows what cards the other players are holding, they will know what cards are in the secret file. A great game for those who enjoy reasoning and thinking things out.</p>",
"age_range": "8+",
"duration": 60,
"image": "https://s3-us-west-1.amazonaws.com/5cc.images/games/uploaded/1559254847936-611WyTryCvL.jpg",
"num_players": "3-6",
"game_type": "Deduction, Family Game"
}
}
]
}
Return information for a specific game night
GET /api/v1/game_nights/{game_night_id}
Default response
{
"data": {
"id": "1",
"type": "game_night",
"attributes": {
"name": "Test Game Night",
"date": "09-21-2021",
"number_of_games": 1,
"games": [
{
"id": 2,
"name": "Pandemic",
"game_type": "Board/Strategy",
"description": "It is our life now",
"duration": 95,
"image": "IMAGE",
"created_at": "2021-01-15T15:28:49.656Z",
"updated_at": "2021-01-15T15:28:49.656Z",
"num_players": "4",
"age_range": "15"
}
],
"confirmed_attendees": [
{
"id": 1,
"name": "Kate",
"email": "Kate@example.com"
}
],
"pending_attendees": [
{
"id": 2,
"name": "Austin",
"email": "Austin@example.com"
},
{
"id": 3,
"name": "Phil",
"email": "Phil@example.com"
}
]
}
}
}
Update a game night.
PATCH /api/v1/game_nights/{game_night_id}
Raw JSON request body
{
"name": "Test Game Night", // optional
"date": "01-21-2021" // optional
}
Delete a game night.
DELETE /api/v1/game_nights/{game_night_id}
See the open issues for a list of proposed features, known issues, and project extensions.
- Austin Aspaas - -
- Eduardo Parra - -
- Garrett Cottrell - -
- Grant Dempsey - -
- Greg Mitchell - -
- Kate Tester - -
- Philip DeFraties - -
- Shaun James - -
- Shaunda Cunningham - -
- Taylor Phillips - -
Thank you to the Board Game Atlas API for providing the board game data that this project relies on.