git clone https://github.com/Amirasyraf222/Interview-Assignment-Rails---Amir-Asyraf.git
cd project
bundle install
rails db:migrate
rails server
Endpoint:
POST http://localhost:3000/auth
Example Request Body (JSON):
{ "email": "testuser@example.com", "password": "password123", "password_confirmation": "password123", "name": "Test User" }
Endpoint:
POST http://localhost:3000/auth/sign_in
Example Request Body (JSON):
{ "email": "user@example.com", "password": "password123" }
Note: For any authenticated API requests, include the following headers:
{ "access-token": "your_generated_token", "client": "your_client_id", "uid": "testuser@example.com", "Content-Type": "application/json" }
Endpoint:
POST http://localhost:3000/car_batteries/create
Example Request Body (JSON):
{ "car_battery": { "brand": "Toyota", "model": "X200", "voltage": 12, "price": 250, "warranty": 24 } }
Endpoint:
PUT http://localhost:3000/car_batteries/:id/update
Example Request Body (JSON):
{ "car_battery": { "brand": "UpdatedBrand", "model": "X300", "voltage": 14, "price": 300, "warranty": 36 } }
Endpoint:
GET http://localhost:3000/car_batteries/:id/view
Endpoint:
DELETE http://localhost:3000/car_batteries/:id/delete
Ensure that the Rails server is running before making API requests.
Always include the required authentication headers when accessing protected routes.
Replace :id in the URL with the actual car battery ID when performing update, view, or delete operations.
This document provides a structured and professional overview of the setup and API functionalities for your Rails project.