Dimba is an application used to manage local football leagues. This is the API of the app
To get started with this project:
- Clone this repository
git clone https://github.com/kaguna/dimba-api.git
cd dimba-api
- Install all the required dependencies
bundle
- Setup the database
This project uses Postgresql. You will need to install postgres.On a Mac do:
brew install postgres
Now setup all the environment variables:
bundle exec figaro install
Inside the generated file in config/application.yml
file, paste the sample data from config/applicaion.yml.sample
file. Edit these variables to fit your local configuration of postgres.
Now do:
rails db:create
rails db:migrate
If you want data sample data in your database, do:
rails db:seed
-
Run the Server
rails s
Endpoint | Method | Description |
---|---|---|
sign_up | POST | Create a new user |
login | POST | Generate token to grant access to API |
Endpoint | Method | Description |
---|---|---|
teams/ | POST | Create a new team |
teams/ | GET | Retrieve all teams |
teams/<team_id> | GET | Retrieve specific team |
teams/<team_id> | PUT | Edit team details |
teams/<team_id> | DELETE | Delete a team |
Endpoint | Method | Description |
---|---|---|
team/<team_id>/players/ | POST | Create a player |
team/<team_id>/players/ | GET | Retrieve specific team's players |
team/<team_id>/player/<player_id> | GET | Retrieve specific team's player |
team/<team_id>/player/<player_id> | PUT | Edit player details |
team/<team_id>/player/<player_id> | DELETE | Delete a player |
Endpoint | Method | Description |
---|---|---|
leagues/ | POST | Create a new league |
leagues/ | GET | Retrieve all leagues |
leagues/<league_id> | GET | Retrieve specific league |
leagues/<league_id> | PUT | Edit league details |
leagues/<league_id> | DELETE | Delete a league |
Endpoint | Method | Description |
---|---|---|
league/:league_id/fixtures/ | POST | Create fixtures/matches of specific league |
league/:league_id/fixtures/ | GET | Retrieve specific league's fixtures |
league/:league_id/fixtures/<fixture_id> | GET | Retrieve specific league's fixture |
league/:league_id/fixtures/<fixture_id> | PUT | Edit fixture details |
league/:league_id/fixtures/<fixture_id> | DELETE | Delete a fixture |
To run tests
rspec spec
Test the API online here.
This repository is a safe place for contribution.
- Fork it (https://github.com/yourname/yourproject/fork)
- Create your feature branch (git checkout -b feature/fooBar)
- Commit your changes (git commit -am 'Add some fooBar')
- Push to the branch (git push origin feature/fooBar)
- Create a new Pull Request