Skip to content
API for Vroom, a rental car booking app
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
alembic
images
tests
utils
vroom
.coveragerc
.gitignore
.travis.yml
LICENSE
Procfile
README.md
alembic.ini
requirements.txt
server.py
server.wsgi

README.md

Build Status codecov

Vroom

Vroom is a React web app that makes renting a car quick and easy. Vroom displays an interactive portal where you can search for a location and dates/times to pick up and drop off your rental car, then select a rental car from different rental companies, and lastly confirm your booking and see a map of how to get to your intended pick-up location. Vroom uses React Geosuggest to suggest Google Maps locations as you search for your pick-up and drop-off cities, as well as Airbnb's react-dates to provide a calendar-based date range selector. Car rental data is acquired via Amadeus' Car Rental Geosearch API. When you confirm your booking, your information gets sent to a RESTful API that stores your data in a PostgreSQL database and returns a unique confirmation code for your booking.

Setup

  1. Clone this repository locally or on your server (git clone https://github.com/estherh5/vroom_api).
  2. Enter the vroom_api directory, and install requirements by running pip install -r requirements.txt.
  3. Create a PostgreSQL database to store Vroom booking data, as well as a user that has all privileges on your database.
  4. Set the following environment variables for the API:
    • FLASK_APP for the Flask application name for your server ("server.py")
    • ENV_TYPE for the environment status (set this to "Dev" for testing or "Prod" for live)
    • DB_CONNECTION for the database URL to connect to your database via SQLAlchemy ORM (i.e., 'dialect+driver://username:password@host:port/database')
    • DB_NAME for the name of your database
  5. Load the initial database structure by running alembic upgrade head.
    • Note that you might need to add PYTHONPATH=. to the beginning of your revision command if Alembic can't find your module.
  6. Start the server by running flask run (if you are making changes while the server is running, enter flask run --reload instead for instant updates).

API

To post and retrieve data for Vroom bookings, a client can send a request to the following endpoints. Booking data gets saved in the database table "booking":


POST /api/vroom/booking

  • Post booking data by sending the jsonified booking information in the request body. No bearer token is needed in the request Authorization header (in the future, user authentication will be required).
  • Example request body:
{
    "car": "ECAR",
    "company_address": "6975 Norwitch Drive, Philadelphia, PA",
    "company_name": "Payless",
    "end_date": "09-21-2018",
    "location": "Philadelphia, PA, USA",
    "price": "41.68",
    "start_date": "09-21-2018"
}


GET /api/vroom/booking/[booking_id]

  • Retrieve booking data by sending the booking id in the request URL. No bearer token is needed in the request Authorization header (in the future, user authentication will be required).
  • Example response body:
{
    "car": "LDAR",
    "company_address": "7500 Holstein Ave, Philadelphia, PA",
    "company_name": "Thrifty",
    "end_date": "10-01-2018",
    "location": "Philadelphia, PA, USA",
    "price": "219.00",
    "start_date": "09-30-2018"
}


PATCH /api/vroom/booking/[booking_id]

  • Update booking data by sending the booking id in the request URL and the updated booking information in the request body. No bearer token is needed in the request Authorization header (in the future, user authentication will be required).
  • Example request body:
{
    "car": "CCAR",
    "company_address": "6975 Norwitch Drive, Philadelphia, PA",
    "company_name": "Payless",
    "end_date":" 09-30-2018",
    "location": "Philadelphia, PA, USA",
    "price": "94.54",
    "start_date": "09-29-2018"
}


DELETE /api/vroom/booking/[booking_id]

  • Delete booking data by sending the booking id in the request URL. No bearer token is needed in the request Authorization header (in the future, user authentication will be required).
  • Example response body:
<booking_id>
You can’t perform that action at this time.