Giter VIP home page Giter VIP logo

airbnb_clone's Introduction

AirBnB Clone Project

Welcome to the AirBnB clone project! This project aims to build an AirBnB web application by implementing a command interpreter. This initial step is crucial, as it establishes the foundation for subsequent tasks such as HTML/CSS templating, database storage, API development, and front-end integration.

Project Overview

Task List

  1. Implement a parent class (BaseModel) responsible for the initialization, serialization, and deserialization of future instances.
  2. Create a simple flow of serialization/deserialization: Instance <-> Dictionary <-> JSON string <-> File.
  3. Define classes for essential AirBnB objects (User, State, City, Place, etc.) that inherit from BaseModel.
  4. Develop the first abstracted storage engine for the project: File storage.
  5. Create comprehensive unit tests to validate all classes and the storage engine.

Command Interpreter

What's a Command Interpreter?

The command interpreter is similar to a shell but tailored for a specific use case. In this project, it allows the management of AirBnB objects, including:

  • Creating a new object (e.g., User, Place).
  • Retrieving an object from a file, database, etc.
  • Performing operations on objects (e.g., counting, computing stats).
  • Updating attributes of an object.
  • Destroying an object.

Execution

Interactive Mode

$ ./console.py
(hbnb) help

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

(hbnb) 
(hbnb) 
(hbnb) quit
$

Non-Interactive Mode

$ 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) 
$

Getting Started

  1. Clone the repository.
https://github.com/wandilemawelela/AirBnB_clone.git
cd AirBnB-clone
  1. Run the command interpreter in interactive mode.
Copy code
./console.py
  1. Explore the documented commands and start managing your AirBnB objects!

Console Commands The AirBnB console supports the following commands: *create Usage: create

Creates a new instance of BaseModel, saves it (to the JSON file) and prints the id *show Usage: show or .show()

(hbnb) create User
(hbnb)
(hbnb) show User uid		
(hbnb) 
(hbnb) User.show(uid)
(hbnb)


*destroy: Usage: destroy <class> <id>
Deletes an instance based on the class name and id (save the change into the JSON file)
*all
Usage: all or all <class>
Prints all string representation of all instances based or not on the class name



 ```$ ./console.py
(hbnb) create BaseModel
(hbnb) create BaseModel
(hbnb) create User
(hbnb) create User
(hbnb)
(hbnb) all BaseModel



*update
Usage: update ```<class> <id>
Updates an instance based on the class name and id by adding or updating attribute

$ ./console.py (hbnb) create User (hbnb) (hbnb) update User id first_name "name" (hbnb) show User uid (hbnb) (hbnb) User.update(uid), address, "address") (hbnb) User.show(uid) (hbnb) (hbnb) User.update(uid, {'email': 'email', 'last_name': 'last_name'}

[Test]

Unittests for the Airbnb_clone project are defined in the tests folder. To run the entire test suite simultaneously, execute the following command:

airbnb_clone's People

Contributors

wandilemawelela avatar tgairwoman avatar

Watchers

 avatar

Forkers

tgairwoman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.