{"id":26715550,"url":"https://github.com/bmmunga/airbnb_clone","last_synced_at":"2025-03-27T14:33:16.692Z","repository":{"id":210979653,"uuid":"727801627","full_name":"bmmunga/AirBnB_clone","owner":"bmmunga","description":null,"archived":false,"fork":false,"pushed_at":"2023-12-19T02:22:31.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T23:33:08.451Z","etag":null,"topics":["html-css","python","testdrivendevelopment"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bmmunga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-05T15:50:00.000Z","updated_at":"2023-12-18T16:17:52.000Z","dependencies_parsed_at":"2024-11-07T08:50:36.169Z","dependency_job_id":null,"html_url":"https://github.com/bmmunga/AirBnB_clone","commit_stats":null,"previous_names":["mungasoftwiz/airbnb_clone","bmmunga/airbnb_clone"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2FAirBnB_clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2FAirBnB_clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2FAirBnB_clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bmmunga%2FAirBnB_clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bmmunga","download_url":"https://codeload.github.com/bmmunga/AirBnB_clone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245863363,"owners_count":20684835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html-css","python","testdrivendevelopment"],"created_at":"2025-03-27T14:33:16.011Z","updated_at":"2025-03-27T14:33:16.653Z","avatar_url":"https://github.com/bmmunga.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/bdbaraban/AirBnB_clone/blob/master/assets/hbnb_logo.png\" alt=\"hbnb logo\"\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003ehbnb\u003c/h1\u003e\n\u003cp align=\"center\"\u003eAn AirBnB clone.\u003c/p\u003e\n\n---\n\n## Description\n\nhbnb is a complete web application, integrating database storage, \na back-end API, and front-end interfacing in a clone of AirBnB.\n\nThis is the first part of the  project that currently only implements\nthe back-end console.\n\n## Storage\n\nThe above classes are handled by the abstracted storage engine defined in the \n[FileStorage](./models/engine/file_storage.py) class.\n\nEvery time the backend is initialized, hbnb instantiates an instance of \n`FileStorage` called `storage`. The `storage` object is loaded/re-loaded from \nany class instances stored in the JSON file `file.json`. As class instances are \ncreated, updated, or deleted, the `storage` object is used to register \ncorresponding changes in the `file.json`.\n\n## Console\n\nThe console is a command line interpreter that permits management of the backend \nof hbnb. It can be used to handle and manipulate all classes utilized by \nthe application (achieved by calls on the `storage` object defined above).\n\n### Using the Console\n\nThe hbnb console can be run both interactively and non-interactively. \nTo run the console in non-interactive mode, pipe any command(s) into an execution \nof the file `console.py` at the command line.\n\n```\n$ echo \"help\" | ./console.py\n(hbnb) \nDocumented commands (type help \u003ctopic\u003e):\n========================================\nEOF  all  count  create  destroy  help  quit  show  update\n\n(hbnb) \n(hbnb)quit\n$\n```\n\nAlternatively, to use the hbnb console in interactive mode, run the \nfile `console.py` by itself:\n\n```\n$ ./console.py\n```\n\nWhile running in interactive mode, the console displays a prompt for input:\n\n```\n$ ./console.py\n(hbnb) \n```\n\nTo quit the console, enter the command `quit`, or input an EOF signal \n(`ctrl-D`).\n\n```\n$ ./console.py\n(hbnb) quit\n$\n```\n\n```\n$ ./console.py\n(hbnb) EOF\n$\n```\n\n### Console Commands\n\nThe hbnb console supports the following commands:\n\n* **create**\n  * Usage: `create \u003cclass\u003e`\n\nCreates a new instance of a given class. The class' ID is printed and \nthe instance is saved to the file `file.json`.\n\n```\n$ ./console.py\n(hbnb) create BaseModel\n119be863-6fe5-437e-a180-b9892e8746b8\n(hbnb) quit\n$ cat file.json ; echo \"\"\n{\"BaseModel.119be863-6fe5-437e-a180-b9892e8746b8\": {\"updated_at\": \"2017-02-17T2\n1:30:42.215277\", \"created_at\": \"2017-02-17T21:30:42.215277\", \"__class__\": \"Base\nModel\", \"id\": \"119be863-6fe5-437e-a180-b9892e8746b8\"}}\n```\n\n* **show**\n  * Usage: `show \u003cclass\u003e \u003cid\u003e` or `\u003cclass\u003e.show(\u003cid\u003e)`\n\nPrints the string representation of a class instance based on a given id.\n\n```\n$ ./console.py\n(hbnb) create User\n1e32232d-5a63-4d92-8092-ac3240b29f46\n(hbnb)\n(hbnb) show User 1e32232d-5a63-4d92-8092-ac3240b29f46\n[User] (1e32232d-5a63-4d92-8092-ac3240b29f46) {'id': '1e32232d-5a63-4d92-8092-a\nc3240b29f46', 'created_at': datetime.datetime(2017, 2, 17, 21, 34, 3, 635828), \n'updated_at': datetime.datetime(2017, 2, 17, 21, 34, 3, 635828)}\n(hbnb) \n(hbnb) User.show(1e32232d-5a63-4d92-8092-ac3240b29f46)\n[User] (1e32232d-5a63-4d92-8092-ac3240b29f46) {'id': '1e32232d-5a63-4d92-8092-a\nc3240b29f46', 'created_at': datetime.datetime(2017, 2, 17, 21, 34, 3, 635828), \n'updated_at': datetime.datetime(2017, 2, 17, 21, 34, 3, 635828)}\n(hbnb) \n```\n* **destroy**\n  * Usage: `destroy \u003cclass\u003e \u003cid\u003e` or `\u003cclass\u003e.destroy(\u003cid\u003e)`\n\nDeletes a class instance based on a given id. The storage file `file.json` \nis updated accordingly.\n\n```\n$ ./console.py\n(hbnb) create State\nd2d789cd-7427-4920-aaae-88cbcf8bffe2\n(hbnb) create Place\n3e-8329-4f47-9947-dca80c03d3ed\n(hbnb)\n(hbnb) destroy State d2d789cd-7427-4920-aaae-88cbcf8bffe2\n(hbnb) Place.destroy(03486a3e-8329-4f47-9947-dca80c03d3ed)\n(hbnb) quit\n$ cat file.json ; echo \"\"\n{}\n```\n\n* **all**\n  * Usage: `all` or `all \u003cclass\u003e` or `\u003cclass\u003e.all()`\n\nPrints the string representations of all instances of a given class. If no \nclass name is provided, the command prints all instances of every class.\n\n```\n$ ./console.py\n(hbnb) create BaseModel\nfce2124c-8537-489b-956e-22da455cbee8\n(hbnb) create BaseModel\n450490fd-344e-47cf-8342-126244c2ba99\n(hbnb) create User\nb742dbc3-f4bf-425e-b1d4-165f52c6ff81\n(hbnb) create User\n8f2d75c8-fb82-48e1-8ae5-2544c909a9fe\n(hbnb)\n(hbnb) all BaseModel\n[\"[BaseModel] (450490fd-344e-47cf-8342-126244c2ba99) {'updated_at': datetime.da\ntetime(2017, 2, 17, 21, 45, 5, 963516), 'created_at': datetime.datetime(2017, 2\n, 17, 21, 45, 5, 963516), 'id': '450490fd-344e-47cf-8342-126244c2ba99'}\", \"[Bas\neModel] (fce2124c-8537-489b-956e-22da455cbee8) {'updated_at': datetime.datetime\n(2017, 2, 17, 21, 43, 56, 899348), 'created_at': datetime.datetime(2017, 2, 17,\n21, 43, 56, 899348), 'id': 'fce2124c-8537-489b-956e-22da455cbee8'}\"]\n(hbnb)\n(hbnb) User.all()\n[\"[User] (8f2d75c8-fb82-48e1-8ae5-2544c909a9fe) {'updated_at': datetime.datetim\ne(2017, 2, 17, 21, 44, 44, 428413), 'created_at': datetime.datetime(2017, 2, 17\n, 21, 44, 44, 428413), 'id': '8f2d75c8-fb82-48e1-8ae5-2544c909a9fe'}\", \"[User] \n(b742dbc3-f4bf-425e-b1d4-165f52c6ff81) {'updated_at': datetime.datetime(2017, 2\n, 17, 21, 44, 15, 974608), 'created_at': datetime.datetime(2017, 2, 17, 21, 44,\n15, 974608), 'id': 'b742dbc3-f4bf-425e-b1d4-165f52c6ff81'}\"]\n(hbnb) \n(hbnb) all\n[\"[User] (8f2d75c8-fb82-48e1-8ae5-2544c909a9fe) {'updated_at': datetime.datetim\ne(2017, 2, 17, 21, 44, 44, 428413), 'created_at': datetime.datetime(2017, 2, 17\n, 21, 44, 44, 428413), 'id': '8f2d75c8-fb82-48e1-8ae5-2544c909a9fe'}\", \"[BaseMo\ndel] (450490fd-344e-47cf-8342-126244c2ba99) {'updated_at': datetime.datetime(20\n19, 2, 17, 21, 45, 5, 963516), 'created_at': datetime.datetime(2017, 2, 17, 21,\n45, 5, 963516), 'id': '450490fd-344e-47cf-8342-126244c2ba99'}\", \"[User] (b742db\nc3-f4bf-425e-b1d4-165f52c6ff81) {'updated_at': datetime.datetime(2017, 2, 17, 2\n1, 44, 15, 974608), 'created_at': datetime.datetime(2017, 2, 17, 21, 44, 15, 97\n4608), 'id': 'b742dbc3-f4bf-425e-b1d4-165f52c6ff81'}\", \"[BaseModel] (fce2124c-8\n537-489b-956e-22da455cbee8) {'updated_at': datetime.datetime(2017, 2, 17, 21, 4\n3, 56, 899348), 'created_at': datetime.datetime(2017, 2, 17, 21, 43, 56, 899348\n), 'id': 'fce2124c-8537-489b-956e-22da455cbee8'}\"]\n(hbnb) \n```\n\n* **count**\n  * Usage: `count \u003cclass\u003e` or `\u003cclass\u003e.count()`\n\nRetrieves the number of instances of a given class.\n\n```\n$ ./console.py\n(hbnb) create Place\n12c73223-f3d3-4dec-9629-bd19c8fadd8a\n(hbnb) create Place\naa229cbb-5b19-4c32-8562-f90a3437d301\n(hbnb) create City\n22a51611-17bd-4d8f-ba1b-3bf07d327208\n(hbnb) \n(hbnb) count Place\n2\n(hbnb) city.count()\n1\n(hbnb) \n```\n\n* **update**\n  * Usage: `update \u003cclass\u003e \u003cid\u003e \u003cattribute name\u003e \"\u003cattribute value\u003e\"` or\n`\u003cclass\u003e.update(\u003cid\u003e, \u003cattribute name\u003e, \u003cattribute value\u003e)` or `\u003cclass\u003e.update(\n\u003cid\u003e, \u003cattribute dictionary\u003e)`.\n\nUpdates a class instance based on a given id with a given key/value attribute \npair or dictionary of attribute pairs. If `update` is called with a single \nkey/value attribute pair, only \"simple\" attributes can be updated (ie. not \n`id`, `created_at`, and `updated_at`). However, any attribute can be updated by \nproviding a dictionary.\n\n```\n$ ./console.py\n(hbnb) create User\n6f348019-0499-420f-8eec-ef0fdc863c02\n(hbnb)\n(hbnb) update User 6f348019-0499-420f-8eec-ef0fdc863c02 first_name \"Betty\"\n(hbnb) show User 6f348019-0499-420f-8eec-ef0fdc863c02\n[User] (6f348019-0499-420f-8eec-ef0fdc863c02) {'created_at': datetime.datetime(\n2017, 2, 17, 21, 54, 39, 234382), 'first_name': 'Betty', 'updated_at': date\ntime.datetime(2017, 2, 17, 21, 54, 39, 234382), 'id': '6f348019-0499-420f-8eec-\nef0fdc863c02'}\n(hbnb)\n(hbnb) User.update(6f348019-0499-420f-8eec-ef0fdc863c02, address, \"98 Mission S\nt\")\n(hbnb) User.show(6f348019-0499-420f-8eec-ef0fdc863c02)\n[User] (6f348019-0499-420f-8eec-ef0fdc863c02) {'created_at': datetime.datetime(\n2017, 2, 17, 21, 54, 39, 234382), 'address': '98 Mission St', 'first_name': 'Betty', \n'updated_at': datetime.datetime(2017, 2, 17, 21, 54, 39, 234382), 'id\n': '6f348019-0499-420f-8eec-ef0fdc863c02'}\n(hbnb)\n(hbnb) User.update(6f348019-0499-420f-8eec-ef0fdc863c02, {'email': 'airbnb@m\nail.com', 'last_name': 'Bar'})\n[User] (6f348019-0499-420f-8eec-ef0fdc863c02) {'email': '@mail.co\nm', 'first_name': 'Betty', 'updated_at': datetime.datetime(2017, 2, 17, 21,\n54, 39, 234382), 'address': '98 Mission St', 'last_name': 'Bar', 'id': '6f34\n8019-0499-420f-8eec-ef0fdc863c02', 'created_at': datetime.datetime(2017, 2, 17,\n21, 54, 39, 234382)}\n(hbnb) \n```\n\n## Testing\n\nUnittests for the hbnb project are defined in the [tests](./tests) \nfolder. To run the entire test suite, execute the following command:\n\n```\n$ python3 unittest -m discover tests\n```\n\nAlternatively, you can specify a single test file to run at a time:\n\n```\n$ python3 unittest -m tests/test_console.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmmunga%2Fairbnb_clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbmmunga%2Fairbnb_clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbmmunga%2Fairbnb_clone/lists"}