Skip to content

DanielMusau/AirBnB_clone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

48 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AirBnB Clone

HBnB Logo

Contents

Description πŸ“„

This is the first phase of a four phase project, to create a basic clone of the AirBnB web app. In this first phase a basic console was created using the Cmd Python module, to manage the objects of the whole project, being able to implement the methods create, show, update, all, and destroy to the existing classes and subclasses.

Environment πŸ’»

The console was developed in Ubuntu 20.04.5LTS using python3 (version 3.10.10).

Further information πŸ“‘

For further information on python version, and documentation visit python.org.

Requirements πŸ“

Knowledge in python3, how to use a command line interpreter, a computer with Ubuntu 20.04.5, python3 and pep8 style corrector.

Repo Contents πŸ“‹

This repository constains the following files:

File Description
AUTHORS Contains info about authors of the project
base_model.py Defines BaseModel class (parent class), and methods
user.py Defines subclass User
amenity.py Defines subclass Amenity
city.py Defines subclass City
place.py Defines subclass Place
review.py Defines subclass Review
state.py Defines subclass State
file_storage.py Creates new instance of class, serializes and deserializes data
console.py creates object, retrieves object from file, does operations on objects, updates attributes of object and destroys object
test_base_model.py unittests for base_model

Installation πŸ› οΈ

Clone the repository and run the console.py

$ git clone https://github.com/------/AirBnB_clone.git
$ cd AirBnB_clone
$ ./console.py

Usage πŸ”§

Method Description
create Creates object of given class
show Prints the string representation of an instance based on the class name and id
all Prints all string representation of all instances based or not on the class name
update Updates an instance based on the class name and id by adding or updating attribute (save the change into the JSON file)
destroy Deletes an instance based on the class name and id (save the change into the JSON file)
count Retrieve the number of instances of a class
help Prints information about specific command
quit/ EOF Exit the program
Example No.1
➜  AirBnB_clone git:(feature) βœ— ./console.py
(hbnb) create User
bb4f4b81-7757-460b-9263-743c9ea6fef6
(hbnb) show User bb4f4b81-7757-460b-9263-743c9ea6fef6
[User] (bb4f4b81-7757-460b-9263-743c9ea6fef6) {'updated_at': datetime.datetime(2019, 11, 13, 17, 7, 45, 492139), 'id': 'bb4f4b81-7757-460b-9263-743c9ea6fef6', 'created_at': datetime.datetime(2019, 11, 13, 17, 7, 45, 492106)}
(hbnb) all User
["[User] (bb4f4b81-7757-460b-9263-743c9ea6fef6) {'updated_at': datetime.datetime(2019, 11, 13, 17, 7, 45, 492139), 'id': 'bb4f4b81-7757-460b-9263-743c9ea6fef6', 'created_at': datetime.datetime(2019, 11, 13, 17, 7, 45, 492106)}"]
(hbnb) update User bb4f4b81-7757-460b-9263-743c9ea6fef6 name Betty
['User', 'bb4f4b81-7757-460b-9263-743c9ea6fef6', 'name', 'Betty']
(hbnb) all User
["[User] (bb4f4b81-7757-460b-9263-743c9ea6fef6) {'updated_at': datetime.datetime(2019, 11, 13, 17, 7, 45, 492139), 'id': 'bb4f4b81-7757-460b-9263-743c9ea6fef6', 'name': 'Betty', 'created_at': datetime.datetime(2019, 11, 13, 17, 7, 45, 492106)}"]
(hbnb) destroy User bb4f4b81-7757-460b-9263-743c9ea6fef6
(hbnb) all User
[]
(hbnb) show User
** instance id missing **
(hbnb)

Example No.2
➜  AirBnB_clone git:(feature) βœ— ./console.py
(hbnb) User.all()
["[User] (e6ee5344-04ef-454d-84e4-ba6fc613f1b4) {'id': 'e6ee5344-04ef-454d-84e4-ba6fc613f1b4', 'updated_at': datetime.datetime(2019, 11, 13, 17, 14, 1, 963404), 'created_at': datetime.datetime(2019, 11, 13, 17, 14, 1, 963373)}"]
(hbnb) User.show()
** instance id missing **
(hbnb) User.show(e6ee5344-04ef-454d-84e4-ba6fc613f1b4)
[User] (e6ee5344-04ef-454d-84e4-ba6fc613f1b4) {'id': 'e6ee5344-04ef-454d-84e4-ba6fc613f1b4', 'updated_at': datetime.datetime(2019, 11, 13, 17, 14, 1, 963404), 'created_at': datetime.datetime(2019, 11, 13, 17, 14, 1, 963373)}
(hbnb) quit
➜  AirBnB_clone git:(feature) βœ—

Built with βš™οΈ

python3 (3.10.10)

Version πŸ“Œ

HBnB - version 9.6

Acknowledgements πŸ™Œ

To all the peers that contribuited with their knowledge

Authors πŸ–‹οΈ

  • Daniel Musau - @DanielMbithiMusau
  • Kris Adelowo - @krisphinna

About

πŸ”“ AirBnB clone project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published