{"id":17681322,"url":"https://github.com/madeindjs/market_place_api_6","last_synced_at":"2025-05-12T21:13:38.929Z","repository":{"id":39696919,"uuid":"189015191","full_name":"madeindjs/market_place_api_6","owner":"madeindjs","description":"Code example of API on Rails 6 book https://github.com/madeindjs/api_on_rails","archived":false,"fork":false,"pushed_at":"2023-03-08T20:11:37.000Z","size":117,"stargazers_count":22,"open_issues_count":7,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T21:13:26.591Z","etag":null,"topics":["api-rest","jsonapi","rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/madeindjs.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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-28T11:28:36.000Z","updated_at":"2024-07-30T01:02:24.000Z","dependencies_parsed_at":"2024-11-12T18:37:05.426Z","dependency_job_id":null,"html_url":"https://github.com/madeindjs/market_place_api_6","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeindjs%2Fmarket_place_api_6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeindjs%2Fmarket_place_api_6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeindjs%2Fmarket_place_api_6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madeindjs%2Fmarket_place_api_6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madeindjs","download_url":"https://codeload.github.com/madeindjs/market_place_api_6/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823462,"owners_count":21969848,"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":["api-rest","jsonapi","rails"],"created_at":"2024-10-24T09:10:48.896Z","updated_at":"2025-05-12T21:13:38.910Z","avatar_url":"https://github.com/madeindjs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Market Place API\n\nThis repository contains application example build into the [API on Rails 6](https://github.com/madeindjs/api_on_rails) book.\n\nThis final application will scratch the surface of being a market place where users will be able to place orders, upload products and more. There are plenty of options out there to set up an online store, such as [Shopify](http://shopify.com), [Spree](http://spreecommerce.com/) or [Magento](http://magento.com).\n\nThe purpose of this application is not only to teach you how to build an API with Rails but rather to teach you how to build an _evolutive_ and _maintainable_ API with Rails. That is, improve your current knowledge with Rails. On this journey, you will learn to:\n\n- Building JSON responses\n- Test your end-points with unit and functional tests\n- Set up authentication with JSON Web Tokens (JWT)\n- Optimize and cache the API\n\n## Setup\n\n```bash\ngit clone https://github.com/madeindjs/market_place_api_6\ncd market_place_api_6\nbundle install\nrake db:create\nrake db:migrate\n```\n\n## Usage\n\nCreate user\n\n```sh\ncurl -X POST -d 'user[email]=toto@toto.fr' -d 'user[password]=toto1234' localhost:3000/api/v1/users\n```\n\nObtain token\n\n```sh\ncurl -X POST -d 'user[email]=toto@toto.fr' -d 'user[password]=toto1234' localhost:3000/api/v1/tokens\n```\n\nManage product\n\n```sh\nexport TKN=\"eyJhbG...WqaXAcnE\" # from /api/v1/tokens\n# create\ncurl -X POST -H \"Authorization: $TKN\" -d \"product[title]=Bag\" -d \"product[price]=10\" localhost:3000/api/v1/products\n# update: publish and add stock\ncurl -X PATCH -H \"Authorization: $TKN\" -d \"product[published]=true\" -d \"product[quantity]=2\" localhost:3000/api/v1/products/19\n# list\ncurl -H \"Authorization: $TKN\" localhost:3000/api/v1/products\n# delete\ncurl -X DELETE -H \"Authorization: $TKN\" localhost:3000/api/v1/products/19\n```\n\nManage order\n\n```sh\nexport TKN=\"eyJhbG...WqaXAcnE\" # from /api/v1/tokens\n# create\ncurl -X POST -H \"Authorization: $TKN\" -d \"order[product_ids_and_quantities][][product_id]=20\" -d \"order[product_ids_and_quantities][][quantity]=1\" localhost:3000/api/v1/orders\n# list\ncurl -H \"Authorization: $TKN\" localhost:3000/api/v1/orders\n# show\ncurl -H \"Authorization: $TKN\" localhost:3000/api/v1/orders/7\n```\n\n## Requirments\n\n- Ruby 2.5+\n- Sqlite\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeindjs%2Fmarket_place_api_6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadeindjs%2Fmarket_place_api_6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadeindjs%2Fmarket_place_api_6/lists"}