Skip to content

semaed/holbertonschool-AirBnB_clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AirBnB Clone

📋 Table of Contents

  1. Introduction
  2. Synopsis
  3. Project
  1. Authors

📜Introduction

  • In this project we coded from scratch an AirBnb clone.
  • This is the first phase of the Airbnb Clone: the console. This repository holds a command interpreter and classes (i.e. BaseModel class and several other classes that inherit from it: Amenity, City, State, Place, Review), and a command interpreter. The command interpreter, like a shell, can be activated, take in user input, and perform certain tasks to manipulate the object instances.

Back to Top

💡Synopsis

The application begins in console.py, which calls an instance of the FileStorage class in init.py. This class manages all files within the storage system. For file operations, the FileStorage class calls methods from the base_model.py and file_storage.py scripts, each responsible for different aspects of the system.

Back to Top

💽Project

📑Python Scripts Requirements

  • Allowed editors: vi, vim, emacs
  • All your files will be interpreted/compiled on Ubuntu 20.04 LTS using python3 (version 3.8.5)
  • All your files should end with a new line
  • The first line of all your files should be exactly #!/usr/bin/python3
  • A README.md file, at the root of the folder of the project, is mandatory
  • Your code should use the pycodestyle (version 2.7.*)
  • All your files must be executable
  • The length of your files will be tested using wc
  • All your modules should have a documentation (python3 -c 'print(import("my_module").doc)')
  • All your classes should have a documentation (python3 -c 'print(import("my_module").MyClass.doc)')
  • All your functions (inside and outside a class) should have a documentation (python3 -c 'print(import("my_module").my_function.doc)' and python3 -c ' 'print(import("my_module").MyClass.my_function.doc)')
  • A documentation is not a simple word, it’s a real sentence explaining what’s the purpose of the module, class or method (the length of it will be verified)

📑Python Unit Tests Requirements

  • Allowed editors: vi, vim, emacs
  • All your files should end with a new line
  • All your test files should be inside a folder tests
  • You have to use the unittest module
  • All your test files should be python files (extension: .py)
  • All your test files and folders should start by test_
  • Your file organization in the tests folder should be the same as your project
  • e.g., For models/base_model.py, unit tests must be in: tests/test_models/test_base_model.py
  • e.g., For models/user.py, unit tests must be in: tests/test_models/test_user.py
  • All your tests should be executed by using this command: python3 -m unittest discover tests
  • You can also test file by file by using this command: python3 -m unittest tests/test_models/test_base_model.py
  • All your modules should have a documentation (python3 -c 'print(import("my_module").doc)')
  • All your classes should have a documentation (python3 -c 'print(import("my_module").MyClass.doc)')
  • All your functions (inside and outside a class) should have a documentation (python3 -c 'print(import("my_module").my_function.doc)' and python3 -c ' 'print(import("my_module").MyClass.my_function.doc)')

💻Functions and system calls used

🗃Description of each file

File Name Description
console.py Entry point for the application. It provides a user interface for the console. It contains the main loop that waits for input from the user, processes the input and provides output.
__init__.py Initialises a new instance of FileStorage. This is the setup file for the models package. It contains import statements for all classes in the package, creating an instance of the FileStorage class and immediately calling the reload() method on it.
base_model.py Contains the BaseModel class, with common methods for saving, updating, and deleting records. It defines the attributes that are common to all other classes, and methods for managing the serialization and deserialization of instances. ($)
file_storage.py Contains the FileStorage class, which handles serialization and deserialization of instances to JSON format, writing and reading from a JSON file. It is also responsible for managing the dictionary objects, where all instances are stored, and for saving and loading instances to and from the JSON file.
user.py A user model that inherits from BaseModel. This class represents a user of the application. Attributes include email, password, first_name, and last_name.
state.py A state model that inherits from BaseModel. This class represents a state. It includes an attribute name for the name of the state.
city.py A city model that inherits from BaseModel. This class represents a city. Attributes include state_id and name. state_id is a string that represents the id of the State instance the City is linked to. name is the name of the city.
amenity.py An amenity model that inherits from BaseModel. This class represents an amenity. It includes an attribute name for the name of the amenity.
place.py A place model that inherits from BaseModel. This class represents a place. Attributes include city_id, user_id, name, description, number_rooms, number_bathrooms, max_guest, price_by_night, latitude, longitude, and amenity_ids.
review.py A review model that inherits from BaseModel. This class represents a review. Attributes include place_id, user_id, and text.

🌎Environment

  • Language: Python
  • OS: Ubuntu 20.04
  • Compiler: python3 (version 3.8.5)
  • Style guideines: pycodestyle (version 2.7.*)

💻Testing

-You can test our custom version of the AirBnb Clone in the interactive and non-interactive mode.

💻Interactive mode

  • The console should work like this in interactive mode:
    $ ./console.py
(hbnb) help

Documented commands (type help <topic>):
========================================

EOF  help  quit

(hbnb) 

(hbnb) 

(hbnb) quit
$

💻Non-Interactive mode

-In the non-interactive mode should work like this:

  $ echo "help" | ./console.py
(hbnb)

Documented commands (type help <topic>):
========================================

EOF  help  quit
(hbnb)

$

$ cat test_help

help

$

$ cat test_help | ./console.py

(hbnb)

Documented commands (type help <topic>):

========================================

EOF  help  quit

(hbnb) 

$

Back to Top

🤝Authors

Braian Perez Eduardo Figueroa

Back to Top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published