Git Product home page Git Product logo

oluwaninsolaao / airbnb_clone Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uthmanduro/airbnb_clone

1.0 0.0 0.0 142 KB

This project is aimed towards creating a exact clone of the AirBnB website, with some of its features. The project is set to evolve in stages with the first step being: Write a command interpreter to manage your AirBnB objects.

Shell 1.88% Python 74.62% HTML 15.77% CSS 7.73%

airbnb_clone's Introduction

AirBnB_clone

This project is aimed towards creating a exact clone of the AirBnB website, with some of its features. The project is set to evolve in stages with the first step being: Write a command interpreter to manage your AirBnB objects.

Step 1: Write a command interpreter to manage your AirBnB objects

Using cmd.Cmd This first step covers the following features for the command interpreter features:

  • Create a new object (ex: a new User or a new Place)
  • Retrieve an object from a file, a database etc…
  • Do operations on objects (count, compute stats, etc…)
  • Update attributes of an object
  • Destroy an object

Clone this repository

Clone the repository to your machine with the following:

$ git clone https://github.com/Uthmanduro/AirBnB_clone.git

How to start the AirBnB Command Interpreter

After cloning the repository, the interpreter can be started using:

$ ./console.py

For a start, the console had no intro screen, so the only visible changes you will noticed is the change of prompt:

(hbnb) 

How to use the AirBnB Command Interpreter

Get yourself farmilar with all the basic commands using help, with no additional arguements: the prompt will show a list of possible commands, each of which is properly documented.

Examples

Using help command

(hbnb) help

Documented commands (type help <topic>):
========================================
EOF  all  create  destroy  help  quit  show  update

(hbnb) help all

        all [class]: Prints a list containing string representation
        of all instances in the storage path, optional `[class]` name
        can be passed to print only a list of  matching object with
        the class.

        valid <classes>: ['BaseModel', 'User', 'State', 'City',
                          'Amenity', 'Place', 'Review']
        
(hbnb)  

Using create command

(hbnb) help create

        create <class>: creates a new instance of <class>, and saves the
        new <class> instance into a JSON file, then prints/return the
        instace id of new <class> instance.

        valid <classes>: ['BaseModel', 'User', 'State', 'City',
                          'Amenity', 'Place', 'Review']
        
(hbnb) create BaseModel
5df9ed71-6987-4677-afab-69aecae4e0ed
(hbnb) 

Using show command

(hbnb) help show

        show <class> <instance id>: Prints the string representation
        of the instance with matching `instance id`.

        valid <classes>: ['BaseModel', 'User', 'State', 'City',
                          'Amenity', 'Place', 'Review']
        
(hbnb) show BaseModel 8f8a68a6-eee8-42e4-a488-28200576ad32
[BaseModel] (8f8a68a6-eee8-42e4-a488-28200576ad32) {'id': '8f8a68a6-eee8-42e4-a488-28200576ad32', 'created_at': datetime.datetime(2023, 2, 11, 13, 42, 25, 362754), 'updated_at': datetime.datetime(2023, 2, 11, 13, 42, 25, 362939)}
(hbnb) 

Using update command

(hbnb) help update

        update <class> <instance id> <attribute name> <attribute value>:
        Updates matching instance with a new or existing attribute.

        valid <classes>: ['BaseModel', 'User', 'State', 'City',
                          'Amenity', 'Place', 'Review']

(hbnb) create User
eba6a509-f540-4160-ab9d-22909fc56eee
(hbnb) show User eba6a509-f540-4160-ab9d-22909fc56eee
[User] (eba6a509-f540-4160-ab9d-22909fc56eee) {'id': 'eba6a509-f540-4160-ab9d-22909fc56eee', 'created_at': datetime.datetime(2023, 2, 11, 13, 54, 38, 842700), 'updated_at': datetime.datetime(2023, 2, 11, 13, 54, 38, 842777)}
(hbnb) update User eba6a509-f540-4160-ab9d-22909fc56eee email "[email protected]"(hbnb) show User eba6a509-f540-4160-ab9d-22909fc56eee
[User] (eba6a509-f540-4160-ab9d-22909fc56eee) {'id': 'eba6a509-f540-4160-ab9d-22909fc56eee', 'created_at': datetime.datetime(2023, 2, 11, 13, 54, 38, 842700), 'updated_at': datetime.datetime(2023, 2, 11, 13, 55, 12, 343148), 'email': '[email protected]'}
(hbnb) 

Using destroy command

(hbnb) help destroy

        destroy <class> <instance id>: Destroy the object instance
        of with the matching `instance id`.

        valid <classes>: ['BaseModel', 'User', 'State', 'City',
                          'Amenity', 'Place', 'Review']
        
(hbnb) show User eba6a509-f540-4160-ab9d-22909fc56eee
[User] (eba6a509-f540-4160-ab9d-22909fc56eee) {'id': 'eba6a509-f540-4160-ab9d-22909fc56eee', 'created_at': datetime.datetime(2023, 2, 11, 13, 54, 38, 842700), 'updated_at': datetime.datetime(2023, 2, 11, 13, 55, 12, 343148), 'email': '[email protected]'}
(hbnb) destroy User eba6a509-f540-4160-ab9d-22909fc56eee
(hbnb) show User eba6a509-f540-4160-ab9d-22909fc56eee
** no instance found **
(hbnb) 

airbnb_clone's People

Contributors

oluwaninsolaao avatar uthmanduro avatar

Stargazers

 avatar

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.