A Rails 8.0 API application with user authentication.
- Ruby (version specified in
.ruby-version) - SQLite 3
- Clone the repository:
git clone <repository-url>
cd elevate-api-
Upload the provided .env file or add the billing service JWT token yourself
-
Install dependencies and set up the database:
bin/setupThis script will:
- Install Ruby gems
- Set up the database
- Clear logs and temporary files
- Start the development server automatically
The API requires authentication for most endpoints using a Bearer token in the Authorization header:
Authorization: Bearer <session_token>
POST /api/sessions
Content-Type: application/json
{
"email": "user@example.com",
"password": "your_password"
}
Returns a session token to use for authenticated requests.
POST /api/user
Content-Type: application/json
{
"email": "user@example.com",
"password": "your_password"
}
GET /api/user
Authorization: Bearer <session_token>
POST /api/user/game_events
Authorization: Bearer <session_token>
Content-Type: application/json
{
"game_event": {
"type": "COMPLETED"
}
}
Increments the user's games_played counter.
The project uses RSpec for testing.
To run the test suite:
bundle exec rspec