Skip to content

thurman024/elevate-api

Repository files navigation

Elevate API

A Rails 8.0 API application with user authentication.

Requirements

  • Ruby (version specified in .ruby-version)
  • SQLite 3

Setup

  1. Clone the repository:
git clone <repository-url>
cd elevate-api
  1. Upload the provided .env file or add the billing service JWT token yourself

  2. Install dependencies and set up the database:

bin/setup

This script will:

  • Install Ruby gems
  • Set up the database
  • Clear logs and temporary files
  • Start the development server automatically

Usage

The API requires authentication for most endpoints using a Bearer token in the Authorization header:

Authorization: Bearer <session_token>

Authentication Endpoints

Login

POST /api/sessions
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "your_password"
}

Returns a session token to use for authenticated requests.

User Endpoints

Create User

POST /api/user
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "your_password"
}

Get User Profile

GET /api/user
Authorization: Bearer <session_token>

Game Events

Track Game Completion

POST /api/user/game_events
Authorization: Bearer <session_token>
Content-Type: application/json

{
  "game_event": {
    "type": "COMPLETED"
  }
}

Increments the user's games_played counter.

Testing

The project uses RSpec for testing.

To run the test suite:

bundle exec rspec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published