An API for retrieving the theoretical D&D statistics of your favorite NFL players, and forming parties of NFL players!
This API requires Ruby version 2.7.4 or later.
To use this API for your own personal use, please follow the proceeding steps:
- Fork this repository.
- Clone this repository.
- Run
bundle install
. - Run
bundle exec rails db:{drop,create,migrate}
. - Run
rails csv_load:players
. - Run
rails s
. - Enjoy!
GET /api/v1/players
- This endpoint searches through a list of all available players, and returns a list of all players with the queryed name. Requires a query parametername
for a player's name. This search is case-insensitive, and finds all players containing the name.
- Example Response, query parameters -
name: 'timmy'
:
{
"data": [
{
"id": "1",
"type": "player",
"attributes": {
"name": "Timmy Jones",
[...]
}
},
{
"id": "2",
"type": "player",
"attributes": {
"name": "Jones Timmy",
[...]
}
},
{
"id": "3",
"type": "player",
"attributes": {
"name": "ghgtimmyhghdkjs",
[...]
}
}
]
}
GET /api/v1/players/:id
- Retrieves the individual player statistics of the requested player, based on their ID within the database.
- Example Response:
{
"data": {
"id": "1",
"type": "player",
"attributes": {
"name": "Gerald",
"strength": 15,
"dexterity": 14,
"constitution": 13,
"intelligence": 8,
"wisdom": 15,
"charisma": 12
"class": {
"name": "wizard",
"description": "fireballs and stuff"
"hitpoints": 9,
"proficiencies": [
'thing1',
'thing2',
'thing3'
]
}
}
}
}
GET /api/v1/party
- Retrieves the currently authenticated user's party. Requires auser_id
query parameter.
- Example Response, query parameters -
user_id: 8
:
{
"data": {
"id": "16",
"type": "party",
"attributes": {
"name": "Awesome party",
"user_id": "8",
"relationships": {
"players": {
"data": [
{
"type": 'player',
"id": 10,
"name": 'billy'
},
{
"type": 'player',
"id": 12,
"name": 'billy'
}
}
},
"user": {
"data": {
"type": "user",
"id": 8
}
}
]
}
}
}
POST /api/v1/party/players
- Adds a player to the currently authenticated user's party, taking inplayer_id
anduser_id
query parameters to assign the player.
- Example Response, query parameters -
user_id: 123456789, player_id: 1
:
{
"data": {
"id": 123456789,
"type": "party",
"attributes": {
"name": "Awesome party",
"relationships": {
"players": {
"data": [
{
"type": "player",
"id": 1,
"name": "Gerald"
}
]
},
"user" : {
"data": {
"type": "user",
"id": 123456789
}
}
}
}
}
}
If you have questions or concerns, please open an issue here on GitHub!
If you wish to contribute, please do the following:
- Create an issue for the new contribution.
- Write your code.
- Submit a pull request to merge your code into the
staging
branch, NOTmain
. - Your code will be reviewed and either merged, or rejected with feedback.