├── tests ├── __init__.py └── test_models │ ├── __init__.py │ ├── test_engine │ ├── __init__.py │ └── test_file_storage.py │ ├── test_state.py │ ├── test_amenity.py │ ├── test_city.py │ ├── test_review.py │ ├── test_user.py │ ├── test_base_model.py │ └── test_place.py ├── models ├── engine │ ├── __init__.py │ └── file_storage.py ├── __init__.py ├── state.py ├── city.py ├── amenity.py ├── review.py ├── user.py ├── place.py └── base_model.py ├── .gitignore ├── web_static ├── README.md ├── styles │ ├── 2-common.css │ ├── 2-header.css │ ├── 3-header.css │ ├── 2-footer.css │ ├── 3-common.css │ ├── 3-footer.css │ ├── 4-common.css │ ├── 7-places.css │ ├── 4-filters.css │ ├── 5-filters.css │ ├── 6-filters.css │ ├── 8-places.css │ ├── 100-places.css │ └── 101-places.css ├── images │ ├── icon.png │ ├── logo.png │ ├── icon_bed.png │ ├── icon_tv.png │ ├── icon_bath.png │ ├── icon_group.png │ ├── icon_pets.png │ └── icon_wifi.png ├── 2-index.html ├── 3-index.html ├── 0-index.html ├── 4-index.html ├── 1-index.html ├── 5-index.html ├── 6-index.html ├── 7-index.html ├── 8-index.html ├── 100-index.html └── 101-index.html ├── image └── hbnb_logo.png ├── .travis.yml ├── AUTHORS ├── LICENSE ├── console.py └── README.md /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /models/engine/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/test_models/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Emacs buffer 2 | *# 3 | *~ -------------------------------------------------------------------------------- /tests/test_models/test_engine/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web_static/README.md: -------------------------------------------------------------------------------- 1 | # AirBnB clone - Web static -------------------------------------------------------------------------------- /web_static/styles/2-common.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 0; 3 | margin: 0; 4 | } -------------------------------------------------------------------------------- /image/hbnb_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/image/hbnb_logo.png -------------------------------------------------------------------------------- /web_static/images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon.png -------------------------------------------------------------------------------- /web_static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/logo.png -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - '3.4' 4 | 5 | script: 6 | - python3 -m unittest discover tests 7 | -------------------------------------------------------------------------------- /web_static/images/icon_bed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon_bed.png -------------------------------------------------------------------------------- /web_static/images/icon_tv.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon_tv.png -------------------------------------------------------------------------------- /web_static/images/icon_bath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon_bath.png -------------------------------------------------------------------------------- /web_static/images/icon_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon_group.png -------------------------------------------------------------------------------- /web_static/images/icon_pets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon_pets.png -------------------------------------------------------------------------------- /web_static/images/icon_wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luischaparroc/AirBnB_clone/HEAD/web_static/images/icon_wifi.png -------------------------------------------------------------------------------- /web_static/styles/2-header.css: -------------------------------------------------------------------------------- 1 | header { 2 | background-color: #FF0000; 3 | height:70px; 4 | width:100%; 5 | } 6 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This file lists all individuals having contributed content to the repository. 2 | 3 | Laura Peralta 4 | Luis Chaparro 5 | -------------------------------------------------------------------------------- /models/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ Import modules and packages """ 3 | from models.engine.file_storage import FileStorage 4 | 5 | storage = FileStorage() 6 | storage.reload() 7 | -------------------------------------------------------------------------------- /models/state.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Class that defines a state 4 | """ 5 | from models.base_model import BaseModel 6 | 7 | 8 | class State(BaseModel): 9 | """class to create a state""" 10 | name = "" 11 | -------------------------------------------------------------------------------- /models/city.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Defines city 4 | """ 5 | from models.base_model import BaseModel 6 | 7 | 8 | class City(BaseModel): 9 | """defines city to look for""" 10 | state_id = "" 11 | name = "" 12 | -------------------------------------------------------------------------------- /web_static/styles/3-header.css: -------------------------------------------------------------------------------- 1 | header { 2 | background: white url("../images/logo.png"); 3 | background-repeat: no-repeat; 4 | background-position: 20px center; 5 | height: 70px; 6 | width: 100%; 7 | border-bottom: 1px solid #CCCCCC; 8 | } 9 | -------------------------------------------------------------------------------- /models/amenity.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Defines amenities 4 | """ 5 | from models.base_model import BaseModel 6 | 7 | 8 | class Amenity(BaseModel): 9 | """Defines amenities that user can choose from to offer at its place""" 10 | name = "" 11 | -------------------------------------------------------------------------------- /web_static/styles/2-footer.css: -------------------------------------------------------------------------------- 1 | footer { 2 | background-color: #00FF00; 3 | height: 60px; 4 | width: 100%; 5 | bottom: 0; 6 | position: absolute; 7 | display: flex; 8 | align-items: center; 9 | justify-content: center; 10 | } 11 | -------------------------------------------------------------------------------- /models/review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Defines review class 4 | """ 5 | from models.base_model import BaseModel 6 | 7 | 8 | class Review(BaseModel): 9 | """Reviews made by users about a place""" 10 | place_id = "" 11 | user_id = "" 12 | text = "" 13 | -------------------------------------------------------------------------------- /models/user.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | User creation class 4 | """ 5 | from models.base_model import BaseModel 6 | 7 | 8 | class User(BaseModel): 9 | """Defines attributes for user creation""" 10 | email = "" 11 | password = "" 12 | first_name = "" 13 | last_name = "" 14 | -------------------------------------------------------------------------------- /web_static/styles/3-common.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | min-height: 100vh; 3 | } 4 | 5 | body { 6 | padding: 0; 7 | margin: 0; 8 | color: #484848; 9 | font-size: 14px; 10 | font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; 11 | display: flex; 12 | flex-direction: column; 13 | } 14 | -------------------------------------------------------------------------------- /web_static/styles/3-footer.css: -------------------------------------------------------------------------------- 1 | footer { 2 | background-color: white; 3 | height: 60px; 4 | width: 100%; 5 | border-top: 1px solid #CCCCCC; 6 | display: flex; 7 | align-items: center; 8 | justify-content: center; 9 | bottom: 0; 10 | box-sizing: border-box; 11 | position: absolute; 12 | } 13 | -------------------------------------------------------------------------------- /models/place.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Defines Place class 4 | """ 5 | from models.base_model import BaseModel 6 | 7 | 8 | class Place(BaseModel): 9 | """Defines Place class""" 10 | city_id = "" 11 | user_id = "" 12 | name = "" 13 | description = "" 14 | number_bathrooms = 0 15 | number_rooms = 0 16 | max_guest = 0 17 | price_by_night = 0 18 | latitude = 0.0 19 | longitude = 0.0 20 | amenity_ids = [] 21 | -------------------------------------------------------------------------------- /web_static/2-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 |

Holberton School

14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /web_static/3-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |

Holberton School

15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /web_static/0-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 |
9 |
10 |

Holberton School

11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /web_static/styles/4-common.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | padding: 0; 3 | margin: 0; 4 | min-height: 100vh; 5 | } 6 | 7 | html { 8 | position: relative; 9 | } 10 | 11 | body { 12 | color: #484848; 13 | font-size: 14px; 14 | font-family: Circular,"Helvetica Neue",Helvetica,Arial,sans-serif; 15 | } 16 | 17 | .container { 18 | max-width: 1000px; 19 | margin: 30px auto; 20 | } 21 | 22 | h4 { 23 | font-weight: 400; 24 | font-size: 14px; 25 | } 26 | 27 | ul { 28 | list-style: none; 29 | padding: 10px; 30 | } 31 | -------------------------------------------------------------------------------- /web_static/styles/7-places.css: -------------------------------------------------------------------------------- 1 | .places { 2 | display:flex; 3 | flex-wrap: wrap; 4 | justify-content: center; 5 | margin-bottom: 50px; 6 | } 7 | 8 | .places h1 { 9 | font-size: 30px; 10 | width: 100%; 11 | margin-left: 20px; 12 | } 13 | 14 | .places article { 15 | width: 390px; 16 | padding: 20px; 17 | margin: 20px; 18 | border: 1px solid #FF5A5F; 19 | border-radius: 4px; 20 | display: flex; 21 | justify-content: center; 22 | } 23 | 24 | .places article h2 { 25 | font-size: 30px; 26 | } 27 | -------------------------------------------------------------------------------- /web_static/styles/4-filters.css: -------------------------------------------------------------------------------- 1 | .filters { 2 | background: white; 3 | height: 70px; 4 | width: 100%; 5 | border: 1px solid #DDDDDD; 6 | border-radius: 4px; 7 | display: flex; 8 | align-items: center; 9 | justify-content: flex-start; 10 | } 11 | 12 | .filters button { 13 | font-size: 18px; 14 | background-color: #FF5A5F; 15 | color: #FFFFFF; 16 | height: 48px; 17 | width: 20%; 18 | border: none; 19 | border-radius: 4px; 20 | margin-right: 30px; 21 | margin-left: auto; 22 | outline: none; 23 | } 24 | 25 | .filters button:hover { 26 | opacity: 0.9; 27 | } 28 | -------------------------------------------------------------------------------- /web_static/4-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 | 17 |
18 |
19 |
20 |

Holberton School

21 |
22 | 23 | 24 | -------------------------------------------------------------------------------- /web_static/1-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | AirBnB clone 5 | 26 | 27 | 28 |
29 |
30 |

Holberton School

31 |
32 | 33 | 34 | -------------------------------------------------------------------------------- /web_static/5-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 |

States

18 |

California, Arizona...

19 |
20 |
21 |

Amenities

22 |

Internet, Kitchen...

23 |
24 | 25 |
26 |
27 |
28 |

Holberton School

29 |
30 | 31 | 32 | -------------------------------------------------------------------------------- /web_static/styles/5-filters.css: -------------------------------------------------------------------------------- 1 | .filters { 2 | background: white; 3 | height: 70px; 4 | width: 100%; 5 | border: 1px solid #DDDDDD; 6 | border-radius: 4px; 7 | display: flex; 8 | align-items: center; 9 | justify-content: flex-start; 10 | } 11 | 12 | .filters button { 13 | font-size: 18px; 14 | background-color: #FF5A5F; 15 | color: #FFFFFF; 16 | height: 48px; 17 | width: 20%; 18 | border: none; 19 | border-radius: 4px; 20 | margin-right: 30px; 21 | margin-left: auto; 22 | outline: none; 23 | } 24 | 25 | .filters button:hover { 26 | opacity: 0.9; 27 | } 28 | 29 | .locations, .amenities { 30 | height: 100%; 31 | width: 25%; 32 | display: flex; 33 | flex-direction: column; 34 | justify-content: center; 35 | position: relative; 36 | } 37 | 38 | .locations { 39 | border-right: 1px solid #DDDDDD; 40 | } 41 | 42 | .locations h3, .amenities h3 { 43 | font-weight: 600; 44 | margin: 0 0 2px 20px; 45 | } 46 | 47 | .locations h4, .amenities h4 { 48 | font-weight: 400; 49 | font-size: 14px; 50 | margin: 2px 0 0 20px; 51 | } 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Luis Chaparro 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/test_models/test_state.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Unittest for amenity.py 4 | """ 5 | import unittest 6 | from models.state import State 7 | import datetime 8 | 9 | 10 | class TestState(unittest.TestCase): 11 | """ Tests instances and methods from State class """ 12 | 13 | s = State() 14 | 15 | def test_class_exists(self): 16 | """tests if class exists""" 17 | res = "" 18 | self.assertEqual(str(type(self.s)), res) 19 | 20 | def test_user_inheritance(self): 21 | """test if State is a subclass of BaseModel""" 22 | self.assertIsInstance(self.s, State) 23 | 24 | def testHasAttributes(self): 25 | """verify if attributes exist""" 26 | self.assertTrue(hasattr(self.s, 'name')) 27 | self.assertTrue(hasattr(self.s, 'id')) 28 | self.assertTrue(hasattr(self.s, 'created_at')) 29 | self.assertTrue(hasattr(self.s, 'updated_at')) 30 | 31 | def test_types(self): 32 | """tests if the type of the attribute is the correct one""" 33 | self.assertIsInstance(self.s.name, str) 34 | self.assertIsInstance(self.s.id, str) 35 | self.assertIsInstance(self.s.created_at, datetime.datetime) 36 | self.assertIsInstance(self.s.updated_at, datetime.datetime) 37 | 38 | if __name__ == '__main__': 39 | unittest.main() 40 | -------------------------------------------------------------------------------- /tests/test_models/test_amenity.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Unittest for amenity.py 4 | """ 5 | import unittest 6 | from models.amenity import Amenity 7 | import datetime 8 | 9 | 10 | class TestAmenity(unittest.TestCase): 11 | """Tests instances and methods from amenity class""" 12 | 13 | a = Amenity() 14 | 15 | def test_class_exists(self): 16 | """tests if class exists""" 17 | res = "" 18 | self.assertEqual(str(type(self.a)), res) 19 | 20 | def test_user_inheritance(self): 21 | """test if Amenity is a subclass of BaseModel""" 22 | self.assertIsInstance(self.a, Amenity) 23 | 24 | def testHasAttributes(self): 25 | """verify if attributes exist""" 26 | self.assertTrue(hasattr(self.a, 'name')) 27 | self.assertTrue(hasattr(self.a, 'id')) 28 | self.assertTrue(hasattr(self.a, 'created_at')) 29 | self.assertTrue(hasattr(self.a, 'updated_at')) 30 | 31 | def test_types(self): 32 | """tests if the type of the attribute is the correct one""" 33 | self.assertIsInstance(self.a.name, str) 34 | self.assertIsInstance(self.a.id, str) 35 | self.assertIsInstance(self.a.created_at, datetime.datetime) 36 | self.assertIsInstance(self.a.updated_at, datetime.datetime) 37 | 38 | if __name__ == '__main__': 39 | unittest.main() 40 | -------------------------------------------------------------------------------- /tests/test_models/test_city.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Unittest for user.py 4 | """ 5 | import unittest 6 | from models.city import City 7 | import datetime 8 | 9 | 10 | class TestCity(unittest.TestCase): 11 | """Tests instances and methods from city class""" 12 | 13 | c = City() 14 | 15 | def test_class_exists(self): 16 | """tests if class exists""" 17 | self.assertEqual(str(type(self.c)), "") 18 | 19 | def test_user_inheritance(self): 20 | """test if city is a subclass of BaseModel""" 21 | self.assertTrue(self.c, City) 22 | 23 | def testHasAttributes(self): 24 | """verify if attributes exist""" 25 | self.assertTrue(hasattr(self.c, 'state_id')) 26 | self.assertTrue(hasattr(self.c, 'name')) 27 | self.assertTrue(hasattr(self.c, 'id')) 28 | self.assertTrue(hasattr(self.c, 'created_at')) 29 | self.assertTrue(hasattr(self.c, 'updated_at')) 30 | 31 | def test_types(self): 32 | """tests if the type of the attribute is the correct one""" 33 | self.assertIsInstance(self.c.state_id, str) 34 | self.assertIsInstance(self.c.name, str) 35 | self.assertIsInstance(self.c.id, str) 36 | self.assertIsInstance(self.c.created_at, datetime.datetime) 37 | self.assertIsInstance(self.c.updated_at, datetime.datetime) 38 | 39 | if __name__ == '__main__': 40 | unittest.main() 41 | -------------------------------------------------------------------------------- /tests/test_models/test_review.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Unittest for review.py 4 | """ 5 | import unittest 6 | from models.review import Review 7 | import datetime 8 | 9 | 10 | class TestReview(unittest.TestCase): 11 | """Tests instances and methods from Review class""" 12 | 13 | r = Review() 14 | 15 | def test_class_exists(self): 16 | """tests if class exists""" 17 | res = "" 18 | self.assertEqual(str(type(self.r)), res) 19 | 20 | def test_user_inheritance(self): 21 | """test if Review is a subclass of BaseModel""" 22 | self.assertIsInstance(self.r, Review) 23 | 24 | def testHasAttributes(self): 25 | """verify if attributes exist""" 26 | self.assertTrue(hasattr(self.r, 'place_id')) 27 | self.assertTrue(hasattr(self.r, 'user_id')) 28 | self.assertTrue(hasattr(self.r, 'text')) 29 | self.assertTrue(hasattr(self.r, 'id')) 30 | self.assertTrue(hasattr(self.r, 'created_at')) 31 | self.assertTrue(hasattr(self.r, 'updated_at')) 32 | 33 | def test_types(self): 34 | """tests if the type of the attribute is the correct one""" 35 | self.assertIsInstance(self.r.place_id, str) 36 | self.assertIsInstance(self.r.user_id, str) 37 | self.assertIsInstance(self.r.text, str) 38 | self.assertIsInstance(self.r.id, str) 39 | self.assertIsInstance(self.r.created_at, datetime.datetime) 40 | self.assertIsInstance(self.r.updated_at, datetime.datetime) 41 | -------------------------------------------------------------------------------- /web_static/styles/6-filters.css: -------------------------------------------------------------------------------- 1 | .filters { 2 | background: white; 3 | height: 70px; 4 | width: 100%; 5 | border: 1px solid #DDDDDD; 6 | border-radius: 4px; 7 | display: flex; 8 | align-items: center; 9 | justify-content: flex-start; 10 | } 11 | 12 | .filters button { 13 | font-size: 18px; 14 | background-color: #FF5A5F; 15 | color: #FFFFFF; 16 | height: 48px; 17 | width: 20%; 18 | border: none; 19 | border-radius: 4px; 20 | margin-right: 30px; 21 | margin-left: auto; 22 | outline: none; 23 | } 24 | 25 | .filters button:hover { 26 | opacity: 0.9; 27 | } 28 | 29 | .locations, section.filters .amenities { 30 | height: 100%; 31 | width: 25%; 32 | display: flex; 33 | flex-direction: column; 34 | justify-content: center; 35 | position: relative; 36 | } 37 | 38 | .locations { 39 | border-right: 1px solid #DDDDDD; 40 | } 41 | 42 | .locations h3, section.filters .amenities h3 { 43 | font-weight: 600; 44 | margin: 0 0 2px 20px; 45 | } 46 | 47 | .locations h4, section.filters .amenities h4 { 48 | margin: 2px 0 0 20px; 49 | } 50 | 51 | ul.popover { 52 | background-color: #FAFAFA; 53 | border: 1px solid #DDDDDD; 54 | border-radius: 4px; 55 | width: 100%; 56 | box-sizing: border-box; 57 | top:0; 58 | display: none; 59 | margin-top: 70px; 60 | position: absolute; 61 | z-index: 1; 62 | } 63 | 64 | ul.popover ul li h2 { 65 | font-size: 16px; 66 | } 67 | 68 | .filters div:hover ul.popover { 69 | display: block; 70 | } 71 | -------------------------------------------------------------------------------- /web_static/6-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 |
16 |
17 |

States

18 |

California, Arizona...

19 |
    20 |
  • 21 |
      22 |
    • California

    • 23 |
    • San Francisco
    • 24 |
    • Los Angeles
    • 25 |
    26 |
  • 27 |
  • 28 |
      29 |
    • Arizona

    • 30 |
    • Phoenix
    • 31 |
    • Grand Canyon
    • 32 |
    33 |
  • 34 |
35 |
36 |
37 |

Amenities

38 |

Internet, Kitchen...

39 |
    40 |
  • Internet
  • 41 |
  • TV
  • 42 |
  • Kitchen
  • 43 |
  • Games
  • 44 |
45 |
46 | 47 |
48 |
49 |
50 |

Holberton School

51 |
52 | 53 | 54 | -------------------------------------------------------------------------------- /tests/test_models/test_user.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Unittest for user.py 4 | """ 5 | import unittest 6 | from models.user import User 7 | import datetime 8 | 9 | 10 | class UserCase(unittest.TestCase): 11 | """Tests instances and methods from user class""" 12 | 13 | u = User() 14 | 15 | def test_class_exists(self): 16 | """tests if class exists""" 17 | self.assertEqual(str(type(self.u)), "") 18 | 19 | def test_user_inheritance(self): 20 | """test if User is a subclass of BaseModel""" 21 | self.assertIsInstance(self.u, User) 22 | 23 | def testHasAttributes(self): 24 | """verify if attributes exist""" 25 | self.assertTrue(hasattr(self.u, 'email')) 26 | self.assertTrue(hasattr(self.u, 'password')) 27 | self.assertTrue(hasattr(self.u, 'first_name')) 28 | self.assertTrue(hasattr(self.u, 'last_name')) 29 | self.assertTrue(hasattr(self.u, 'id')) 30 | self.assertTrue(hasattr(self.u, 'created_at')) 31 | self.assertTrue(hasattr(self.u, 'updated_at')) 32 | 33 | def test_types(self): 34 | """tests if the type of the attribute is the correct one""" 35 | self.assertIsInstance(self.u.first_name, str) 36 | self.assertIsInstance(self.u.last_name, str) 37 | self.assertIsInstance(self.u.email, str) 38 | self.assertIsInstance(self.u.password, str) 39 | self.assertIsInstance(self.u.id, str) 40 | self.assertIsInstance(self.u.created_at, datetime.datetime) 41 | self.assertIsInstance(self.u.updated_at, datetime.datetime) 42 | 43 | if __name__ == '__main__': 44 | unittest.main() 45 | -------------------------------------------------------------------------------- /tests/test_models/test_base_model.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ Module of Unittests """ 3 | import unittest 4 | from models.base_model import BaseModel 5 | import os 6 | from models import storage 7 | from models.engine.file_storage import FileStorage 8 | import datetime 9 | 10 | 11 | class BaseModelTests(unittest.TestCase): 12 | """ Suite of Console Tests """ 13 | 14 | my_model = BaseModel() 15 | 16 | def testBaseModel1(self): 17 | """ Test attributes value of a BaseModel instance """ 18 | 19 | self.my_model.name = "Holberton" 20 | self.my_model.my_number = 89 21 | self.my_model.save() 22 | my_model_json = self.my_model.to_dict() 23 | 24 | self.assertEqual(self.my_model.name, my_model_json['name']) 25 | self.assertEqual(self.my_model.my_number, my_model_json['my_number']) 26 | self.assertEqual('BaseModel', my_model_json['__class__']) 27 | self.assertEqual(self.my_model.id, my_model_json['id']) 28 | 29 | def testSave(self): 30 | """ Checks if save method updates the public instance instance 31 | attribute updated_at """ 32 | self.my_model.first_name = "First" 33 | self.my_model.save() 34 | 35 | self.assertIsInstance(self.my_model.id, str) 36 | self.assertIsInstance(self.my_model.created_at, datetime.datetime) 37 | self.assertIsInstance(self.my_model.updated_at, datetime.datetime) 38 | 39 | first_dict = self.my_model.to_dict() 40 | 41 | self.my_model.first_name = "Second" 42 | self.my_model.save() 43 | sec_dict = self.my_model.to_dict() 44 | 45 | self.assertEqual(first_dict['created_at'], sec_dict['created_at']) 46 | self.assertNotEqual(first_dict['updated_at'], sec_dict['updated_at']) 47 | 48 | if __name__ == '__main__': 49 | unittest.main() 50 | -------------------------------------------------------------------------------- /models/engine/file_storage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Class that serializes instances to a JSON file 4 | and deserializes JSON file to instances 5 | """ 6 | import json 7 | import os 8 | 9 | 10 | class FileStorage: 11 | """ Class that serializes and deserializes JSON objects """ 12 | __file_path = "file.json" 13 | __objects = {} 14 | 15 | def all(self): 16 | """ Returns the dictionary __objects """ 17 | return FileStorage.__objects 18 | 19 | def new(self, obj): 20 | """ Sets in __objects the obj with key .id """ 21 | key = obj.__class__.__name__ + "." + obj.id 22 | FileStorage.__objects[key] = obj 23 | 24 | def save(self): 25 | """ Serializes __objects to the JSON file """ 26 | dictionary = {} 27 | 28 | for key, value in FileStorage.__objects.items(): 29 | dictionary[key] = value.to_dict() 30 | 31 | with open(FileStorage.__file_path, 'w') as f: 32 | json.dump(dictionary, f) 33 | 34 | def reload(self): 35 | """ Deserializes __objects from the JSON file """ 36 | from models.base_model import BaseModel 37 | from models.user import User 38 | from models.place import Place 39 | from models.city import City 40 | from models.amenity import Amenity 41 | from models.state import State 42 | from models.review import Review 43 | dct = {'BaseModel': BaseModel, 'User': User, 'Place': Place, 44 | 'City': City, 'Amenity': Amenity, 'State': State, 45 | 'Review': Review} 46 | 47 | if os.path.exists(FileStorage.__file_path) is True: 48 | with open(FileStorage.__file_path, 'r') as f: 49 | for key, value in json.load(f).items(): 50 | self.new(dct[value['__class__']](**value)) 51 | -------------------------------------------------------------------------------- /web_static/styles/8-places.css: -------------------------------------------------------------------------------- 1 | .places { 2 | display:flex; 3 | flex-wrap: wrap; 4 | justify-content: center; 5 | margin-bottom: 50px; 6 | } 7 | 8 | .places h1 { 9 | font-size: 30px; 10 | width: 100%; 11 | margin-left: 20px; 12 | } 13 | 14 | .places article { 15 | width: 390px; 16 | padding: 20px; 17 | margin: 20px; 18 | border: 1px solid #FF5A5F; 19 | border-radius: 4px; 20 | display: inline-block; 21 | text-align: center; 22 | position: relative; 23 | } 24 | 25 | .places article h2 { 26 | font-size: 30px; 27 | } 28 | 29 | .price_by_night { 30 | color: #FF5A5F; 31 | border: 4px solid #FF5A5F; 32 | border-radius: 50%; 33 | height: 60px; 34 | font-size: 30px; 35 | min-width: 60px; 36 | position: absolute; 37 | top: 20px; 38 | right: 20px; 39 | text-align: center; 40 | line-height: 60px; 41 | } 42 | 43 | .information { 44 | height: 80px; 45 | border-top: 1px solid #DDDDDD; 46 | border-bottom: 1px solid #DDDDDD; 47 | display: flex; 48 | justify-content: center; 49 | } 50 | 51 | .max_guest, .number_rooms, .number_bathrooms { 52 | width: 100px; 53 | background-repeat: no-repeat; 54 | background-position: top center; 55 | display: flex; 56 | justify-content: center; 57 | align-items: flex-end; 58 | } 59 | 60 | .max_guest { 61 | background-image: url('../images/icon_group.png'); 62 | } 63 | 64 | .number_rooms { 65 | background-image: url('../images/icon_bed.png'); 66 | } 67 | 68 | .number_bathrooms { 69 | background-image: url('../images/icon_bath.png'); 70 | } 71 | 72 | .max_guest h4, .number_rooms h4, .number_bathrooms h4 { 73 | margin: 5px; 74 | } 75 | 76 | .user { 77 | display: flex; 78 | padding-top: 20px; 79 | } 80 | 81 | .user h4 { 82 | margin-left: 5px; 83 | } 84 | 85 | .user h3, .user h4 { 86 | margin-bottom: 0; 87 | } 88 | 89 | .description { 90 | text-align: left; 91 | } 92 | -------------------------------------------------------------------------------- /models/base_model.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/pyhon3 2 | """ 3 | Parent class that will inherit 4 | """ 5 | import uuid 6 | from datetime import datetime 7 | from models import storage 8 | 9 | 10 | class BaseModel: 11 | """Defines all common attributes/methods 12 | """ 13 | def __init__(self, *args, **kwargs): 14 | """initializes all attributes 15 | """ 16 | if not kwargs: 17 | self.id = str(uuid.uuid4()) 18 | self.created_at = datetime.now() 19 | self.updated_at = self.created_at 20 | storage.new(self) 21 | else: 22 | f = "%Y-%m-%dT%H:%M:%S.%f" 23 | for key, value in kwargs.items(): 24 | if key == 'created_at' or key == 'updated_at': 25 | value = datetime.strptime(kwargs[key], f) 26 | if key != '__class__': 27 | setattr(self, key, value) 28 | 29 | def __str__(self): 30 | """returns class name, id and attribute dictionary 31 | """ 32 | class_name = "[" + self.__class__.__name__ + "]" 33 | dct = {k: v for (k, v) in self.__dict__.items() if (not v) is False} 34 | return class_name + " (" + self.id + ") " + str(dct) 35 | 36 | def save(self): 37 | """updates last update time 38 | """ 39 | self.updated_at = datetime.now() 40 | storage.save() 41 | 42 | def to_dict(self): 43 | """creates a new dictionary, adding a key and returning 44 | datemtimes converted to strings 45 | """ 46 | new_dict = {} 47 | 48 | for key, values in self.__dict__.items(): 49 | if key == "created_at" or key == "updated_at": 50 | new_dict[key] = values.strftime("%Y-%m-%dT%H:%M:%S.%f") 51 | else: 52 | if not values: 53 | pass 54 | else: 55 | new_dict[key] = values 56 | new_dict['__class__'] = self.__class__.__name__ 57 | 58 | return new_dict 59 | -------------------------------------------------------------------------------- /web_static/7-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |

States

19 |

California, Arizona...

20 |
    21 |
  • 22 |
      23 |
    • California

    • 24 |
    • San Francisco
    • 25 |
    • Los Angeles
    • 26 |
    27 |
  • 28 |
  • 29 |
      30 |
    • Arizona

    • 31 |
    • Phoenix
    • 32 |
    • Grand Canyon
    • 33 |
    34 |
  • 35 |
36 |
37 |
38 |

Amenities

39 |

Internet, Kitchen...

40 |
    41 |
  • Internet
  • 42 |
  • TV
  • 43 |
  • Kitchen
  • 44 |
  • Games
  • 45 |
46 |
47 | 48 |
49 |
50 |

Places

51 |
52 |

My home

53 |
54 |
55 |

Tiny house

56 |
57 |
58 |

A suite

59 |
60 |
61 |
62 |
63 |

Holberton School

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /tests/test_models/test_place.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ 3 | Unittest for amenity.py 4 | """ 5 | import unittest 6 | from models.place import Place 7 | import datetime 8 | 9 | 10 | class TestPlace(unittest.TestCase): 11 | """Tests instances and methods from amenity class""" 12 | 13 | p = Place() 14 | 15 | def test_class_exists(self): 16 | """tests if class exists""" 17 | self.assertEqual(str(type(self.p)), "") 18 | 19 | def test_user_inheritance(self): 20 | """test if Place is a subclass of BaseModel""" 21 | self.assertIsInstance(self.p, Place) 22 | 23 | def testHasAttributes(self): 24 | """verify if attributes exist""" 25 | self.assertTrue(hasattr(self.p, 'city_id')) 26 | self.assertTrue(hasattr(self.p, 'user_id')) 27 | self.assertTrue(hasattr(self.p, 'name')) 28 | self.assertTrue(hasattr(self.p, 'description')) 29 | self.assertTrue(hasattr(self.p, 'number_rooms')) 30 | self.assertTrue(hasattr(self.p, 'number_bathrooms')) 31 | self.assertTrue(hasattr(self.p, 'max_guest')) 32 | self.assertTrue(hasattr(self.p, 'price_by_night')) 33 | self.assertTrue(hasattr(self.p, 'latitude')) 34 | self.assertTrue(hasattr(self.p, 'longitude')) 35 | self.assertTrue(hasattr(self.p, 'amenity_ids')) 36 | self.assertTrue(hasattr(self.p, 'id')) 37 | self.assertTrue(hasattr(self.p, 'created_at')) 38 | self.assertTrue(hasattr(self.p, 'updated_at')) 39 | 40 | def test_types(self): 41 | """tests if the type of the attribute is the correct one""" 42 | self.assertIsInstance(self.p.city_id, str) 43 | self.assertIsInstance(self.p.user_id, str) 44 | self.assertIsInstance(self.p.name, str) 45 | self.assertIsInstance(self.p.description, str) 46 | self.assertIsInstance(self.p.number_rooms, int) 47 | self.assertIsInstance(self.p.number_bathrooms, int) 48 | self.assertIsInstance(self.p.max_guest, int) 49 | self.assertIsInstance(self.p.price_by_night, int) 50 | self.assertIsInstance(self.p.latitude, float) 51 | self.assertIsInstance(self.p.longitude, float) 52 | self.assertIsInstance(self.p.amenity_ids, list) 53 | self.assertIsInstance(self.p.id, str) 54 | self.assertIsInstance(self.p.created_at, datetime.datetime) 55 | self.assertIsInstance(self.p.updated_at, datetime.datetime) 56 | 57 | if __name__ == '__main__': 58 | unittest.main() 59 | -------------------------------------------------------------------------------- /web_static/styles/100-places.css: -------------------------------------------------------------------------------- 1 | .places { 2 | display:flex; 3 | flex-wrap: wrap; 4 | justify-content: center; 5 | margin-bottom: 50px; 6 | } 7 | 8 | .places h1 { 9 | font-size: 30px; 10 | width: 100%; 11 | margin-left: 20px; 12 | } 13 | 14 | .places article { 15 | width: 390px; 16 | padding: 20px; 17 | margin: 20px; 18 | border: 1px solid #FF5A5F; 19 | border-radius: 4px; 20 | display: inline-block; 21 | text-align: center; 22 | position: relative; 23 | } 24 | 25 | .places article h2 { 26 | font-size: 30px; 27 | } 28 | 29 | .price_by_night { 30 | color: #FF5A5F; 31 | border: 4px solid #FF5A5F; 32 | border-radius: 50%; 33 | height: 60px; 34 | font-size: 30px; 35 | min-width: 60px; 36 | position: absolute; 37 | top: 20px; 38 | right: 20px; 39 | text-align: center; 40 | line-height: 60px; 41 | } 42 | 43 | .information { 44 | height: 80px; 45 | border-top: 1px solid #DDDDDD; 46 | border-bottom: 1px solid #DDDDDD; 47 | display: flex; 48 | justify-content: center; 49 | } 50 | 51 | .max_guest, .number_rooms, .number_bathrooms { 52 | width: 100px; 53 | background-repeat: no-repeat; 54 | background-position: top center; 55 | display: flex; 56 | justify-content: center; 57 | align-items: flex-end; 58 | } 59 | 60 | .max_guest { 61 | background-image: url('../images/icon_group.png'); 62 | } 63 | 64 | .number_rooms { 65 | background-image: url('../images/icon_bed.png'); 66 | } 67 | 68 | .number_bathrooms { 69 | background-image: url('../images/icon_bath.png'); 70 | } 71 | 72 | .max_guest h4, .number_rooms h4, .number_bathrooms h4 { 73 | margin: 5px; 74 | } 75 | 76 | .user { 77 | display: flex; 78 | padding-top: 20px; 79 | } 80 | 81 | .user h4 { 82 | margin-left: 5px; 83 | } 84 | 85 | .user h3, .user h4 { 86 | margin-bottom: 0; 87 | } 88 | 89 | .description { 90 | text-align: left; 91 | } 92 | 93 | section.places .amenities, section.places .reviews { 94 | margin-top: 40px; 95 | display: block; 96 | text-align: left; 97 | } 98 | 99 | section.places .amenities h2, section.places .reviews h2 { 100 | font-size: 16px; 101 | padding-bottom: 10px; 102 | border-bottom: 1px solid #DDDDDD; 103 | margin-bottom: 0; 104 | } 105 | 106 | section.places .amenities ul { 107 | margin-top: 0; 108 | } 109 | 110 | section.places .amenities ul li { 111 | background-repeat: no-repeat; 112 | height: 20px; 113 | background-size: contain; 114 | padding-left: 25px; 115 | line-height: 25px; 116 | } 117 | 118 | section.places .amenities ul li.liTV { 119 | background-image: url('../images/icon_tv.png'); 120 | } 121 | 122 | section.places .amenities ul li.liWifi { 123 | background-image: url('../images/icon_wifi.png'); 124 | } 125 | 126 | section.places .amenities ul li.liPets { 127 | background-image: url('../images/icon_pets.png'); 128 | } 129 | 130 | section.places .reviews ul { 131 | margin: 0; 132 | padding: 0; 133 | } 134 | 135 | section.places .reviews ul li h3 { 136 | font-size: 14px; 137 | margin-bottom: 5px; 138 | } 139 | 140 | section.places .reviews ul li p { 141 | margin-top: 5px; 142 | font-size: 12px; 143 | } 144 | -------------------------------------------------------------------------------- /web_static/styles/101-places.css: -------------------------------------------------------------------------------- 1 | .places { 2 | display:flex; 3 | flex-wrap: wrap; 4 | justify-content: center; 5 | margin-bottom: 50px; 6 | } 7 | 8 | .places h1 { 9 | font-size: 30px; 10 | width: 100%; 11 | margin-left: 20px; 12 | } 13 | 14 | .places article { 15 | width: 390px; 16 | padding: 20px; 17 | margin: 20px; 18 | border: 1px solid #FF5A5F; 19 | border-radius: 4px; 20 | display: inline-block; 21 | text-align: center; 22 | position: relative; 23 | } 24 | 25 | .places article h2 { 26 | font-size: 30px; 27 | } 28 | 29 | .price_by_night { 30 | color: #FF5A5F; 31 | border: 4px solid #FF5A5F; 32 | border-radius: 50%; 33 | height: 60px; 34 | font-size: 30px; 35 | min-width: 60px; 36 | position: absolute; 37 | top: 20px; 38 | right: 20px; 39 | text-align: center; 40 | line-height: 60px; 41 | } 42 | 43 | .information { 44 | height: 80px; 45 | border-top: 1px solid #DDDDDD; 46 | border-bottom: 1px solid #DDDDDD; 47 | display: flex; 48 | justify-content: center; 49 | } 50 | 51 | .max_guest, .number_rooms, .number_bathrooms { 52 | width: 100px; 53 | background-repeat: no-repeat; 54 | background-position: top center; 55 | display: flex; 56 | justify-content: center; 57 | align-items: flex-end; 58 | } 59 | 60 | .max_guest { 61 | background-image: url('../images/icon_group.png'); 62 | } 63 | 64 | .number_rooms { 65 | background-image: url('../images/icon_bed.png'); 66 | } 67 | 68 | .number_bathrooms { 69 | background-image: url('../images/icon_bath.png'); 70 | } 71 | 72 | .max_guest h4, .number_rooms h4, .number_bathrooms h4 { 73 | margin: 5px; 74 | } 75 | 76 | .user { 77 | display: flex; 78 | padding-top: 20px; 79 | } 80 | 81 | .user h4 { 82 | margin-left: 5px; 83 | } 84 | 85 | .user h3, .user h4 { 86 | margin-bottom: 0; 87 | } 88 | 89 | .description { 90 | text-align: left; 91 | } 92 | 93 | section.places .amenities, section.places .reviews { 94 | margin-top: 40px; 95 | display: block; 96 | text-align: left; 97 | } 98 | 99 | section.places .amenities h2, section.places .reviews h2 { 100 | font-size: 16px; 101 | padding-bottom: 10px; 102 | border-bottom: 1px solid #DDDDDD; 103 | margin-bottom: 0; 104 | } 105 | 106 | section.places .amenities ul { 107 | margin-top: 0; 108 | } 109 | 110 | section.places .amenities ul li { 111 | background-repeat: no-repeat; 112 | height: 20px; 113 | background-size: contain; 114 | padding-left: 25px; 115 | line-height: 25px; 116 | } 117 | 118 | section.places .amenities ul li.liTV { 119 | background-image: url('../images/icon_tv.png'); 120 | } 121 | 122 | section.places .amenities ul li.liWifi { 123 | background-image: url('../images/icon_wifi.png'); 124 | } 125 | 126 | section.places .amenities ul li.liPets { 127 | background-image: url('../images/icon_pets.png'); 128 | } 129 | 130 | section.places .reviews ul { 131 | margin: 0; 132 | padding: 0; 133 | } 134 | 135 | section.places .reviews ul li h3 { 136 | font-size: 14px; 137 | margin-bottom: 5px; 138 | } 139 | 140 | section.places .reviews ul li p { 141 | margin-top: 5px; 142 | font-size: 12px; 143 | } 144 | -------------------------------------------------------------------------------- /tests/test_models/test_engine/test_file_storage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ Module of Unittests """ 3 | import unittest 4 | from models.base_model import BaseModel 5 | from models.engine.file_storage import FileStorage 6 | from models import storage 7 | import os 8 | import json 9 | 10 | 11 | class FileStorageTests(unittest.TestCase): 12 | """ Suite of File Storage Tests """ 13 | 14 | my_model = BaseModel() 15 | 16 | def testClassInstance(self): 17 | """ Check instance """ 18 | self.assertIsInstance(storage, FileStorage) 19 | 20 | def testStoreBaseModel(self): 21 | """ Test save and reload functions """ 22 | self.my_model.full_name = "BaseModel Instance" 23 | self.my_model.save() 24 | bm_dict = self.my_model.to_dict() 25 | all_objs = storage.all() 26 | 27 | key = bm_dict['__class__'] + "." + bm_dict['id'] 28 | self.assertEqual(key in all_objs, True) 29 | 30 | def testStoreBaseModel2(self): 31 | """ Test save, reload and update functions """ 32 | self.my_model.my_name = "First name" 33 | self.my_model.save() 34 | bm_dict = self.my_model.to_dict() 35 | all_objs = storage.all() 36 | 37 | key = bm_dict['__class__'] + "." + bm_dict['id'] 38 | 39 | self.assertEqual(key in all_objs, True) 40 | self.assertEqual(bm_dict['my_name'], "First name") 41 | 42 | create1 = bm_dict['created_at'] 43 | update1 = bm_dict['updated_at'] 44 | 45 | self.my_model.my_name = "Second name" 46 | self.my_model.save() 47 | bm_dict = self.my_model.to_dict() 48 | all_objs = storage.all() 49 | 50 | self.assertEqual(key in all_objs, True) 51 | 52 | create2 = bm_dict['created_at'] 53 | update2 = bm_dict['updated_at'] 54 | 55 | self.assertEqual(create1, create2) 56 | self.assertNotEqual(update1, update2) 57 | self.assertEqual(bm_dict['my_name'], "Second name") 58 | 59 | def testHasAttributes(self): 60 | """verify if attributes exist""" 61 | self.assertEqual(hasattr(FileStorage, '_FileStorage__file_path'), True) 62 | self.assertEqual(hasattr(FileStorage, '_FileStorage__objects'), True) 63 | 64 | def testsave(self): 65 | """verify if JSON exists""" 66 | self.my_model.save() 67 | self.assertEqual(os.path.exists(storage._FileStorage__file_path), True) 68 | self.assertEqual(storage.all(), storage._FileStorage__objects) 69 | 70 | def testreload(self): 71 | """test if reload """ 72 | self.my_model.save() 73 | self.assertEqual(os.path.exists(storage._FileStorage__file_path), True) 74 | dobj = storage.all() 75 | FileStorage._FileStorage__objects = {} 76 | self.assertNotEqual(dobj, FileStorage._FileStorage__objects) 77 | storage.reload() 78 | for key, value in storage.all().items(): 79 | self.assertEqual(dobj[key].to_dict(), value.to_dict()) 80 | 81 | def testSaveSelf(self): 82 | """ Check save self """ 83 | msg = "save() takes 1 positional argument but 2 were given" 84 | with self.assertRaises(TypeError) as e: 85 | FileStorage.save(self, 100) 86 | 87 | self.assertEqual(str(e.exception), msg) 88 | 89 | def test_save_FileStorage(self): 90 | """ Test if 'new' method is working good """ 91 | var1 = self.my_model.to_dict() 92 | new_key = var1['__class__'] + "." + var1['id'] 93 | storage.save() 94 | with open("file.json", 'r') as fd: 95 | var2 = json.load(fd) 96 | new = var2[new_key] 97 | for key in new: 98 | self.assertEqual(var1[key], new[key]) 99 | 100 | if __name__ == '__main__': 101 | unittest.main() 102 | -------------------------------------------------------------------------------- /web_static/8-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |

States

19 |

California, Arizona...

20 |
    21 |
  • 22 |
      23 |
    • California

    • 24 |
    • San Francisco
    • 25 |
    • Los Angeles
    • 26 |
    27 |
  • 28 |
  • 29 |
      30 |
    • Arizona

    • 31 |
    • Phoenix
    • 32 |
    • Grand Canyon
    • 33 |
    34 |
  • 35 |
36 |
37 |
38 |

Amenities

39 |

Internet, Kitchen...

40 |
    41 |
  • Internet
  • 42 |
  • TV
  • 43 |
  • Kitchen
  • 44 |
  • Games
  • 45 |
46 |
47 | 48 |
49 |
50 |

Places

51 |
52 |

My home

53 |
$80
54 |
55 |

2 Guests

56 |

1 Bedroom

57 |

1 Bathroom

58 |
59 |
60 |

Owner:

John Lennon

61 |
62 |
63 |

This is a lovely 1 bedroom and 1 bathroom apartment that can accomodate 2 people. It locates at the center of Shangai and next to subway line 1. 1 stop to People Square, 2 stops to Bund, 3 stops to Jingan Temple.

64 |
65 |
66 |
67 |

Tiny house

68 |
$65
69 |
70 |

4 Guests

71 |

2 Bedrooms

72 |

1 Bathroom

73 |
74 |
75 |

Owner:

Adrienne

76 |
77 |
78 |

Lorem ipsum dolor sit amet consectetur adipiscing elit sapien, eleifend odio ridiculus sodales egestas sem etiam, quis nostra sociosqu enim luctus commodo in. Eleifend platea purus sapien sociis netus convallis nisi sociosqu sed risus fames rutrum, quam mi nullam proin placerat vitae vehicula laoreet ut hendrerit nascetur. Odio potenti quam elementum leo urna bibendum ante quis platea ad, enim quisque imperdiet congue morbi vitae facilisis netus rhoncus, pharetra proin fusce maecenas velit placerat cum erat cubilia.

79 |
80 |
81 |
82 |

A suite

83 |
$180
84 |
85 |

3 Guests

86 |

2 Bedrooms

87 |

2 Bathrooms

88 |
89 |
90 |

Owner:

Luis

91 |
92 |
93 |

Lorem ipsum dolor sit amet consectetur adipiscing elit sapien, eleifend odio ridiculus sodales egestas sem etiam, quis nostra sociosqu enim luctus commodo in. Eleifend platea purus sapien sociis netus convallis nisi sociosqu sed risus fames rutrum, quam mi nullam proin placerat vitae vehicula laoreet ut hendrerit nascetur. Odio potenti quam elementum leo urna bibendum ante quis platea ad, enim quisque imperdiet congue morbi vitae facilisis netus rhoncus, pharetra proin fusce maecenas velit placerat cum erat cubilia.

94 |
95 |
96 |
97 |
98 |
99 |

Holberton School

100 |
101 | 102 | 103 | -------------------------------------------------------------------------------- /console.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | """ Entry point of the command interpreter """ 3 | import cmd 4 | from models import storage 5 | from models.base_model import BaseModel 6 | from models.user import User 7 | from models.place import Place 8 | from models.city import City 9 | from models.amenity import Amenity 10 | from models.state import State 11 | from models.review import Review 12 | import json 13 | import shlex 14 | 15 | 16 | class HBNBCommand(cmd.Cmd): 17 | """Command processor""" 18 | 19 | prompt = "(hbnb) " 20 | l_classes = ['BaseModel', 'User', 'Amenity', 21 | 'Place', 'City', 'State', 'Review'] 22 | 23 | l_c = ['create', 'show', 'update', 'all', 'destroy', 'count'] 24 | 25 | def precmd(self, arg): 26 | """parses command input""" 27 | if '.' in arg and '(' in arg and ')' in arg: 28 | cls = arg.split('.') 29 | cnd = cls[1].split('(') 30 | args = cnd[1].split(')') 31 | if cls[0] in HBNBCommand.l_classes and cnd[0] in HBNBCommand.l_c: 32 | arg = cnd[0] + ' ' + cls[0] + ' ' + args[0] 33 | return arg 34 | 35 | def help_help(self): 36 | """ Prints help command description """ 37 | print("Provides description of a given command") 38 | 39 | def emptyline(self): 40 | """do nothing when empty line""" 41 | pass 42 | 43 | def do_count(self, cls_name): 44 | """counts number of instances of a class""" 45 | count = 0 46 | all_objs = storage.all() 47 | for k, v in all_objs.items(): 48 | clss = k.split('.') 49 | if clss[0] == cls_name: 50 | count = count + 1 51 | print(count) 52 | 53 | def do_create(self, type_model): 54 | """ Creates an instance according to a given class """ 55 | 56 | if not type_model: 57 | print("** class name missing **") 58 | elif type_model not in HBNBCommand.l_classes: 59 | print("** class doesn't exist **") 60 | else: 61 | dct = {'BaseModel': BaseModel, 'User': User, 'Place': Place, 62 | 'City': City, 'Amenity': Amenity, 'State': State, 63 | 'Review': Review} 64 | my_model = dct[type_model]() 65 | print(my_model.id) 66 | my_model.save() 67 | 68 | def do_show(self, arg): 69 | """ Shows string representation of an instance passed """ 70 | 71 | if not arg: 72 | print("** class name missing **") 73 | return 74 | 75 | args = arg.split(' ') 76 | 77 | if args[0] not in HBNBCommand.l_classes: 78 | print("** class doesn't exist **") 79 | elif len(args) == 1: 80 | print("** instance id missing **") 81 | else: 82 | all_objs = storage.all() 83 | for key, value in all_objs.items(): 84 | ob_name = value.__class__.__name__ 85 | ob_id = value.id 86 | if ob_name == args[0] and ob_id == args[1].strip('"'): 87 | print(value) 88 | return 89 | print("** no instance found **") 90 | 91 | def do_destroy(self, arg): 92 | """ Deletes an instance passed """ 93 | 94 | if not arg: 95 | print("** class name missing **") 96 | return 97 | 98 | args = arg.split(' ') 99 | 100 | if args[0] not in HBNBCommand.l_classes: 101 | print("** class doesn't exist **") 102 | elif len(args) == 1: 103 | print("** instance id missing **") 104 | else: 105 | all_objs = storage.all() 106 | for key, value in all_objs.items(): 107 | ob_name = value.__class__.__name__ 108 | ob_id = value.id 109 | if ob_name == args[0] and ob_id == args[1].strip('"'): 110 | del value 111 | del storage._FileStorage__objects[key] 112 | storage.save() 113 | return 114 | print("** no instance found **") 115 | 116 | def do_all(self, arg): 117 | """ Prints string represention of all instances of a given class """ 118 | 119 | if not arg: 120 | print("** class name missing **") 121 | return 122 | 123 | args = arg.split(' ') 124 | 125 | if args[0] not in HBNBCommand.l_classes: 126 | print("** class doesn't exist **") 127 | else: 128 | all_objs = storage.all() 129 | list_instances = [] 130 | for key, value in all_objs.items(): 131 | ob_name = value.__class__.__name__ 132 | if ob_name == args[0]: 133 | list_instances += [value.__str__()] 134 | print(list_instances) 135 | 136 | def do_update(self, arg): 137 | """ Updates an instance based on the class name and id """ 138 | 139 | if not arg: 140 | print("** class name missing **") 141 | return 142 | 143 | a = "" 144 | for argv in arg.split(','): 145 | a = a + argv 146 | 147 | args = shlex.split(a) 148 | 149 | if args[0] not in HBNBCommand.l_classes: 150 | print("** class doesn't exist **") 151 | elif len(args) == 1: 152 | print("** instance id missing **") 153 | else: 154 | all_objs = storage.all() 155 | for key, objc in all_objs.items(): 156 | ob_name = objc.__class__.__name__ 157 | ob_id = objc.id 158 | if ob_name == args[0] and ob_id == args[1].strip('"'): 159 | if len(args) == 2: 160 | print("** attribute name missing **") 161 | elif len(args) == 3: 162 | print("** value missing **") 163 | else: 164 | setattr(objc, args[2], args[3]) 165 | storage.save() 166 | return 167 | print("** no instance found **") 168 | 169 | def do_quit(self, line): 170 | """ Quit command to exit the command interpreter """ 171 | return True 172 | 173 | def do_EOF(self, line): 174 | """ EOF command to exit the command interpreter """ 175 | return True 176 | 177 | 178 | if __name__ == '__main__': 179 | HBNBCommand().cmdloop() 180 | -------------------------------------------------------------------------------- /web_static/100-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |

States

19 |

California, Arizona...

20 |
    21 |
  • 22 |
      23 |
    • California

    • 24 |
    • San Francisco
    • 25 |
    • Los Angeles
    • 26 |
    27 |
  • 28 |
  • 29 |
      30 |
    • Arizona

    • 31 |
    • Phoenix
    • 32 |
    • Grand Canyon
    • 33 |
    34 |
  • 35 |
36 |
37 |
38 |

Amenities

39 |

Internet, Kitchen...

40 |
    41 |
  • Internet
  • 42 |
  • TV
  • 43 |
  • Kitchen
  • 44 |
  • Games
  • 45 |
46 |
47 | 48 |
49 |
50 |

Places

51 |
52 |

My home

53 |
$80
54 |
55 |

2 Guests

56 |

1 Bedroom

57 |

1 Bathroom

58 |
59 |
60 |

Owner:

John Lennon

61 |
62 |
63 |

This is a lovely 1 bedroom and 1 bathroom apartment that can accomodate 2 people. It locates at the center of Shangai and next to subway line 1. 1 stop to People Square, 2 stops to Bund, 3 stops to Jingan Temple.

64 |
65 |
66 |

Amenities

67 |
    68 |
  • TV
  • 69 |
  • Wifi
  • 70 |
  • Pets friendly
  • 71 |
72 |
73 |
74 |

2 Reviews

75 |
    76 |
  • 77 |

    From Bob Dylan the 27th January 2017

    78 |

    Runshi is an epic host. Nothing more I can say. 5 star!

    79 |
  • 80 |
  • 81 |

    From Connor the 4th January 2017

    82 |

    Highly recommended!

    83 |
  • 84 |
85 |
86 |
87 |
88 |

Tiny house

89 |
$65
90 |
91 |

4 Guests

92 |

2 Bedrooms

93 |

1 Bathroom

94 |
95 |
96 |

Owner:

Adrienne

97 |
98 |
99 |

Lorem ipsum dolor sit amet consectetur adipiscing elit sapien, eleifend odio ridiculus sodales egestas sem etiam, quis nostra sociosqu enim luctus commodo in. Eleifend platea purus sapien sociis netus convallis nisi sociosqu sed risus fames rutrum, quam mi nullam proin placerat vitae vehicula laoreet ut hendrerit nascetur. Odio potenti quam elementum leo urna bibendum ante quis platea ad, enim quisque imperdiet congue morbi vitae facilisis netus rhoncus, pharetra proin fusce maecenas velit placerat cum erat cubilia.

100 |
101 |
102 |

Amenities

103 |
    104 |
  • Pets friendly
  • 105 |
106 |
107 |
108 |

1 Review

109 |
    110 |
  • 111 |

    From Max the 15th January 2017

    112 |

    Fantastic place. It was clean, Adrienne was great (even though we did not meet in person) and everything went super smooth. Location is also great if you like running and something a bit more quiet. I would suggest a car or take into consideration that you might have to Uber into the city from the location. Overall, would recommend the place anytime.

    113 |
  • 114 |
115 |
116 |
117 |
118 |

A suite

119 |
$180
120 |
121 |

3 Guests

122 |

2 Bedrooms

123 |

2 Bathrooms

124 |
125 |
126 |

Owner:

Luis

127 |
128 |
129 |

Lorem ipsum dolor sit amet consectetur adipiscing elit sapien, eleifend odio ridiculus sodales egestas sem etiam, quis nostra sociosqu enim luctus commodo in. Eleifend platea purus sapien sociis netus convallis nisi sociosqu sed risus fames rutrum, quam mi nullam proin placerat vitae vehicula laoreet ut hendrerit nascetur. Odio potenti quam elementum leo urna bibendum ante quis platea ad, enim quisque imperdiet congue morbi vitae facilisis netus rhoncus, pharetra proin fusce maecenas velit placerat cum erat cubilia.

130 |
131 |
132 |

Amenities

133 |
    134 |
  • TV
  • 135 |
  • Pets friendly
  • 136 |
137 |
138 |
139 |

3 Reviews

140 |
    141 |
  • 142 |

    From Juan the 20th January 2017

    143 |

    Excellent service

    144 |
  • 145 |
  • 146 |

    From Laura the 5th February 2017

    147 |

    Amazing place

    148 |
  • 149 |
  • 150 |

    From Sebastián the 5th February 2017

    151 |

    Good place to stay!

    152 |
  • 153 |
154 |
155 |
156 |
157 |
158 |
159 |

Holberton School

160 |
161 | 162 | 163 | -------------------------------------------------------------------------------- /web_static/101-index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AirBnB clone 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 |
17 |
18 |

States

19 |

California, Arizona...

20 |
    21 |
  • 22 |
      23 |
    • California

    • 24 |
    • San Francisco
    • 25 |
    • Los Angeles
    • 26 |
    27 |
  • 28 |
  • 29 |
      30 |
    • Arizona

    • 31 |
    • Phoenix
    • 32 |
    • Grand Canyon
    • 33 |
    34 |
  • 35 |
36 |
37 |
38 |

Amenities

39 |

Internet, Kitchen...

40 |
    41 |
  • Internet
  • 42 |
  • TV
  • 43 |
  • Kitchen
  • 44 |
  • Games
  • 45 |
46 |
47 | 48 |
49 |
50 |

Places

51 |
52 |

My home

53 |
$80
54 |
55 |

2 Guests

56 |

1 Bedroom

57 |

1 Bathroom

58 |
59 |
60 |

Owner:

John Lennon

61 |
62 |
63 |

This is a lovely 1 bedroom and 1 bathroom apartment that can accomodate 2 people. It locates at the center of Shangai and next to subway line 1. 1 stop to People Square, 2 stops to Bund, 3 stops to Jingan Temple.

64 |
65 |
66 |

Amenities

67 |
    68 |
  • TV
  • 69 |
  • Wifi
  • 70 |
  • Pets friendly
  • 71 |
72 |
73 |
74 |

2 Reviews

75 |
    76 |
  • 77 |

    From Bob Dylan the 27th January 2017

    78 |

    Runshi is an epic host. Nothing more I can say. 5 star!

    79 |
  • 80 |
  • 81 |

    From Connor the 4th January 2017

    82 |

    Highly recommended!

    83 |
  • 84 |
85 |
86 |
87 |
88 |

Tiny house

89 |
$65
90 |
91 |

4 Guests

92 |

2 Bedrooms

93 |

1 Bathroom

94 |
95 |
96 |

Owner:

Adrienne

97 |
98 |
99 |

Lorem ipsum dolor sit amet consectetur adipiscing elit sapien, eleifend odio ridiculus sodales egestas sem etiam, quis nostra sociosqu enim luctus commodo in. Eleifend platea purus sapien sociis netus convallis nisi sociosqu sed risus fames rutrum, quam mi nullam proin placerat vitae vehicula laoreet ut hendrerit nascetur. Odio potenti quam elementum leo urna bibendum ante quis platea ad, enim quisque imperdiet congue morbi vitae facilisis netus rhoncus, pharetra proin fusce maecenas velit placerat cum erat cubilia.

100 |
101 |
102 |

Amenities

103 |
    104 |
  • Pets friendly
  • 105 |
106 |
107 |
108 |

1 Review

109 |
    110 |
  • 111 |

    From Max the 15th January 2017

    112 |

    Fantastic place. It was clean, Adrienne was great (even though we did not meet in person) and everything went super smooth. Location is also great if you like running and something a bit more quiet. I would suggest a car or take into consideration that you might have to Uber into the city from the location. Overall, would recommend the place anytime.

    113 |
  • 114 |
115 |
116 |
117 |
118 |

A suite

119 |
$180
120 |
121 |

3 Guests

122 |

2 Bedrooms

123 |

2 Bathrooms

124 |
125 |
126 |

Owner:

Luis

127 |
128 |
129 |

Lorem ipsum dolor sit amet consectetur adipiscing elit sapien, eleifend odio ridiculus sodales egestas sem etiam, quis nostra sociosqu enim luctus commodo in. Eleifend platea purus sapien sociis netus convallis nisi sociosqu sed risus fames rutrum, quam mi nullam proin placerat vitae vehicula laoreet ut hendrerit nascetur. Odio potenti quam elementum leo urna bibendum ante quis platea ad, enim quisque imperdiet congue morbi vitae facilisis netus rhoncus, pharetra proin fusce maecenas velit placerat cum erat cubilia.

130 |
131 |
132 |

Amenities

133 |
    134 |
  • TV
  • 135 |
  • Pets friendly
  • 136 |
137 |
138 |
139 |

3 Reviews

140 |
    141 |
  • 142 |

    From Juan the 20th January 2017

    143 |

    Excellent service

    144 |
  • 145 |
  • 146 |

    From Laura the 5th February 2017

    147 |

    Amazing place

    148 |
  • 149 |
  • 150 |

    From Sebastián the 5th February 2017

    151 |

    Good place to stay!

    152 |
  • 153 |
154 |
155 |
156 |
157 |
158 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AirBnB Clone [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/luischaparroc/AirBnB_clone/blob/master/LICENSE) [![Build Status](https://travis-ci.org/luischaparroc/AirBnB_clone.svg?branch=master)](https://travis-ci.org/luischaparroc/AirBnB_clone) 2 | ![HBnB Logo](./image/hbnb_logo.png) 3 | 4 | 5 | ### Contents 6 | 7 | - [Description](#Description) 8 | - [Environment](#Environment) 9 | - [Further Information](#Furtherinformation) 10 | - [Requirements](#Requirements) 11 | - [Repo Contents](#FileContents) 12 | - [Installation](#Installation) 13 | - [Usage](#Usage) 14 | - [Built with](#Built-with) 15 | - [Acknowledgements](#Acknowledgements) 16 | 17 | ## Description :page_facing_up: 18 | 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. 19 | 20 | 21 | ## Environment :computer: 22 | The console was developed in Ubuntu 14.04LTS using python3 (version 3.4.3). 23 | 24 | ### Further information :bookmark_tabs: 25 | For further information on python version, and documentation visit [python.org](https://www.python.org/). 26 | 27 | ## Requirements :memo: 28 | Knowledge in python3, how to use a command line interpreter, a computer with Ubuntu 14.04, python3 and pep8 style corrector. 29 | 30 | ## Repo Contents :clipboard: 31 | This repository constains the following files: 32 | 33 | | **File** | **Description** | 34 | | -------------- | --------------------- | 35 | |[AUTHORS](./AUTHORS) | Contains info about authors of the project | 36 | |[base_model.py](./models/base_model.py) | Defines BaseModel class (parent class), and methods | 37 | |[user.py](./models/user.py) | Defines subclass User | 38 | |[amenity.py](./models/amenity.py) | Defines subclass Amenity | 39 | |[city.py](./models/city.py)| Defines subclass City | 40 | |[place.py](./models/place.py)| Defines subclass Place | 41 | |[review.py](./models/review.py) | Defines subclass Review | 42 | |[state.py](./models/state.py) | Defines subclass State | 43 | |[file_storage.py](./models/engine/file_storage.py) | Creates new instance of class, serializes and deserializes data | 44 | |[console.py](./console.py) | creates object, retrieves object from file, does operations on objects, updates attributes of object and destroys object | 45 | |[test_base_model.py](./tests/test_models/test_base_model.py) | unittests for base_model | 46 | |[test_user.py](./tests/test_models/test_user.py) | unittests for user | 47 | |[test_amenity.py](./tests/test_models/test_amenity.py) | unittests for amenity | 48 | |[test_city.py](./tests/test_models/test_city.py) | unittests for city | 49 | |[test_place.py](./tests/test_models/test_place.py) | unittests for place | 50 | |[test_review.py](./tests/test_models/test_review.py) | unittests for review | 51 | |[test_state.py](./tests/test_models/test_state.py) | unittests for state | 52 | |[test_file_storage.py](./tests/test_models/test_engine/test_file_storage.py) | unittests for file_storage | 53 | |[test_console.py](./tests/test_console.py) | unittests for console | 54 | 55 | 56 | ## Installation :hammer_and_wrench: 57 | Clone the repository and run the console.py 58 | ``` 59 | $ git clone https://github.com/------/AirBnB_clone.git 60 | ``` 61 | 62 | ## Usage :wrench: 63 | 64 | | **Method** | **Description** | 65 | | -------------- | --------------------- | 66 | |[create](./console.py) | Creates object of given class | 67 | |[show](./console.py) | Prints the string representation of an instance based on the class name and id | 68 | |[all](./console.py) | Prints all string representation of all instances based or not on the class name | 69 | |[update](./console.py) | Updates an instance based on the class name and id by adding or updating attribute (save the change into the JSON file) | 70 | |[destroy](./console.py)| Deletes an instance based on the class name and id (save the change into the JSON file) | 71 | |[count](./console.py)| Retrieve the number of instances of a class | 72 | |[help](./console.py)| Prints information about specific command | 73 | |[quit/ EOF](./console.py)| Exit the program | 74 | 75 | ###### Example No.1 76 | 77 | ``` 78 | ➜ AirBnB_clone git:(feature) ✗ ./console.py 79 | (hbnb) create User 80 | bb4f4b81-7757-460b-9263-743c9ea6fef6 81 | (hbnb) show User bb4f4b81-7757-460b-9263-743c9ea6fef6 82 | [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)} 83 | (hbnb) all User 84 | ["[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)}"] 85 | (hbnb) update User bb4f4b81-7757-460b-9263-743c9ea6fef6 name Betty 86 | ['User', 'bb4f4b81-7757-460b-9263-743c9ea6fef6', 'name', 'Betty'] 87 | (hbnb) all User 88 | ["[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)}"] 89 | (hbnb) destroy User bb4f4b81-7757-460b-9263-743c9ea6fef6 90 | (hbnb) all User 91 | [] 92 | (hbnb) show User 93 | ** instance id missing ** 94 | (hbnb) 95 | 96 | ``` 97 | 98 | ###### Example No.2 99 | 100 | ``` 101 | ➜ AirBnB_clone git:(feature) ✗ ./console.py 102 | (hbnb) User.create 103 | *** Unknown syntax: User.create 104 | (hbnb) User.create() 105 | e6ee5344-04ef-454d-84e4-ba6fc613f1b4 106 | (hbnb) User.all() 107 | ["[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)}"] 108 | (hbnb) User.show() 109 | ** instance id missing ** 110 | (hbnb) User.show(e6ee5344-04ef-454d-84e4-ba6fc613f1b4) 111 | [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)} 112 | (hbnb) User.update("e6ee5344-04ef-454d-84e4-ba6fc613f1b4", "name", "Betty") 113 | ['User', '"e6ee5344-04ef-454d-84e4-ba6fc613f1b4"', '"name"', '"Betty"'] 114 | (hbnb) User.all() 115 | ['[User] (e6ee5344-04ef-454d-84e4-ba6fc613f1b4) {\'"name"\': \'"Betty"\', \'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)}'] 116 | (hbnb) User.destroy(e6ee5344-04ef-454d-84e4-ba6fc613f1b4) 117 | (hbnb) User.all() 118 | [] 119 | (hbnb) quit 120 | ➜ AirBnB_clone git:(feature) ✗ 121 | 122 | ``` 123 | 124 | ## Built with :gear: 125 | python3 (3.4.3) 126 | 127 | ### Version :pushpin: 128 | HBnB - version 9.6 129 | 130 | ### Acknowledgements :raised_hands: 131 | To all the peers that contribuited with their knowledge 132 | 133 | ### Authors :fountain_pen: 134 | * Luis Chaparro - @luischaparroc 135 | * Laura Peralta V - @LauraPeraltaV85 136 | --------------------------------------------------------------------------------