Skip to content

CorintoZ/badigeeks-api

Repository files navigation


Markdownify
Pilotes Squad

The new disruptive way of searching rooms

RequirementsFirst setupGemsEndpoints

Room search API based on Badi 🍞

This project is a RoR API that reproduces the main behavior of Badi. The main features that our API implements are:

  • Search locations based on user input
  • Search rooms by location (bounding box)
  • Detailed room representation
  • Similar rooms based on location and price

Requirements 📌

  • Ruby 2.6.5
  • Rails > 6.0.2.1
  • PostgreSQL 12
  • PostGIS 12

First setup 💻

Make sure all requirements are available and clone the repository:

git clone https://github.com/assimovt/badigeeks-api.git

Install all the gems

$ bundle install

As the project uses dotenv, you must setup your environment credentials in side a new file:

$ cp .env .env.development.local

Once the credentials for the database are set, you should create the database

$ rails db:create

Gems 💎

Endpoints 📍

  • GET Location query
    • URI: /locations?keyword=place
    • Return all the locations that match the keyword parameter
    • Uses Nominatim as search engine
    • Working exemple
Mandatory params Value Notes
keyword “Any place you want to search rooms” Must contain at least 3 letters to work properly
  • GET List rooms
    • URI: /rooms?bounds=2.109375,41.345887,2.254601,41.445557&page=1&size=20&order_type=price&order=ASC
    • Return all the rooms within the perimeter
    • Working example
Mandatory params Value Notes
bounds “minimumLongitude, minimumLatitude, maximumLongitude, maximumLatitude” Bounds represents the square where you want to look for rooms
Optional params Value Notes
page 1…* Overflow is handled
size 1…* Specify how many items per page. Overflow is handled
order_type “the attribute you want to use to sort” You can only sort by “price” at the moment
order [ASC, asc, DESC, desc]
min 1...10000 Limit minimum price
max 1...10000 Limit maximum price
  • GET Specific room
    • URI: /rooms/:id
    • Return the details of a specific room by the room id
    • Working example

Models structure and associations 🔨

The current approach for the model structure can be found in the image below. It includes the defined models with its fields and associations among them.

Fill the database 💾

In order to fill the database, you will have to execute the following command:

rake badi_api_request: request_fill_db

This task scrapes the data from Badi’s API in order to use real data.

About

Badi API project | TEAM | DAVID ADRIA DANIEL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •