{"id":15612013,"url":"https://github.com/serradura/rails_app_to_refactor","last_synced_at":"2025-10-18T19:26:16.744Z","repository":{"id":138272749,"uuid":"321875775","full_name":"serradura/rails_app_to_refactor","owner":"serradura","description":"A Rails app that was intentionally designed to be refactored.","archived":false,"fork":false,"pushed_at":"2024-02-22T22:35:53.000Z","size":82,"stargazers_count":34,"open_issues_count":1,"forks_count":27,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T09:31:34.287Z","etag":null,"topics":["refactoring-exercise","ruby","ruby-on-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/serradura.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":"2020-12-16T05:13:50.000Z","updated_at":"2024-04-25T09:23:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9d4d1be-a4dd-475f-aca7-11c8946f7502","html_url":"https://github.com/serradura/rails_app_to_refactor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails_app_to_refactor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails_app_to_refactor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails_app_to_refactor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails_app_to_refactor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serradura","download_url":"https://codeload.github.com/serradura/rails_app_to_refactor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311752,"owners_count":21569090,"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":["refactoring-exercise","ruby","ruby-on-rails"],"created_at":"2024-10-03T06:21:33.172Z","updated_at":"2025-10-18T19:26:11.690Z","avatar_url":"https://github.com/serradura.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README \u003c!-- omit in toc --\u003e\n\nThis Rails app has been intentionally designed in a way that there are areas for improvement.\n\nIt's your mission to find this places and refactor them.\n\n## Requirements to run the app\n\n* Ruby version: `3.2.0`\n\n* Database: `sqlite3`\n\n## How to setup this app\n\n```sh\nbin/setup\n```\n\n## Table of Contents\n\n- [Requirements to run the app](#requirements-to-run-the-app)\n- [How to setup this app](#how-to-setup-this-app)\n- [Table of Contents](#table-of-contents)\n- [Useful commands](#useful-commands)\n- [Examples of cURL requests to interact with the API](#examples-of-curl-requests-to-interact-with-the-api)\n  - [Users](#users)\n    - [Add new user](#add-new-user)\n    - [Display user](#display-user)\n    - [Delete user](#delete-user)\n  - [To-Do Lists](#to-do-lists)\n    - [Add new to-do list](#add-new-to-do-list)\n    - [Display to-do list](#display-to-do-list)\n    - [Display all to-do lists](#display-all-to-do-lists)\n    - [Edit to-do list](#edit-to-do-list)\n    - [Remove to-do list](#remove-to-do-list)\n  - [To-Dos](#to-dos)\n    - [Add new to-do](#add-new-to-do)\n      - [Default list](#default-list)\n      - [In a list](#in-a-list)\n    - [Display to-do](#display-to-do)\n      - [Default list](#default-list-1)\n      - [From a list](#from-a-list)\n    - [Display all to-dos](#display-all-to-dos)\n      - [From a list](#from-a-list-1)\n    - [Edit to-do](#edit-to-do)\n      - [In a list](#in-a-list-1)\n    - [Mark to-do as completed](#mark-to-do-as-completed)\n      - [In a list](#in-a-list-2)\n    - [Mark to-do as incomplete](#mark-to-do-as-incomplete)\n      - [In a list](#in-a-list-3)\n    - [Remove to-do](#remove-to-do)\n      - [From a list](#from-a-list-2)\n\n## Useful commands\n\n* `bin/rails test` - it will run the test suite.\n\n* `bin/rails rubycritic` - it will generate a quality report of this codebase.\n\n## Examples of cURL requests to interact with the API\n\nFirst, run the application:\n\n```sh\nbin/rails s\n```\n\nThen, use some of the following commands to interact with the API resources:\n\n### Users\n\n#### Add new user\n\n```sh\ncurl -X POST \"http://localhost:3000/users\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"user\":{\"name\": \"Serradura\", \"email\": \"serradura@example.com\", \"password\": \"123456\", \"password_confirmation\": \"123456\"}}'\n```\n\n#### Display user\n\n```sh\ncurl -X GET \"http://localhost:3000/user\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Delete user\n\n```sh\ncurl -X DELETE \"http://localhost:3000/user\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n### To-Do Lists\n\n#### Add new to-do list\n\n```sh\ncurl -X POST \"http://localhost:3000/todos_lists\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\" \\\n  -d '{\"todo\":{\"title\": \"Things to learn\"}}'\n```\n\n#### Display to-do list\n\n```sh\ncurl -X GET \"http://localhost:3000/todos_lists/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Display all to-do lists\n\n```sh\ncurl -X GET \"http://localhost:3000/todo_lists\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\nThis resource accepts the following query strings:\n- sort_by (e.g, 'updated_at')\n- order (e.g, 'asc')\n\nPS: Desc is the default order.\n\n**Example:**\n\n```sh\ncurl -X GET \"http://localhost:3000/todo_lists?sort_by=title\" -H \"Content-Type: application/json\" -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Edit to-do list\n\n```sh\ncurl -X PUT \"http://localhost:3000/todo_lists/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\" \\\n  -d '{\"todo\":{\"title\": \"Things to learn\"}}'\n```\n\n#### Remove to-do list\n\n```sh\ncurl -X DELETE \"http://localhost:3000/todo_lists/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n### To-Dos\n\n#### Add new to-do\n\n##### Default list\n\n```sh\ncurl -X POST \"http://localhost:3000/todos\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\" \\\n  -d '{\"todo\":{\"title\": \"Buy coffee\"}}'\n```\n\n##### In a list\n\n```sh\ncurl -X POST \"http://localhost:3000/todo_lists/1/todos\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\" \\\n  -d '{\"todo\":{\"title\": \"Buy coffee\"}}'\n```\n\n#### Display to-do\n\n##### Default list\n\n```sh\ncurl -X GET \"http://localhost:3000/todos/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n##### From a list\n\n```sh\ncurl -X GET \"http://localhost:3000/todo_lists/1/todos/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Display all to-dos\n\nThis resource accepts the following query strings:\n- status (e.g, 'completed')\n- sort_by (e.g, 'updated_at')\n- order (e.g, 'asc')\n\nPS: Desc is the default order.\n\n**Example:**\n\n```sh\ncurl -X GET \"http://localhost:3000/todos?status=\u0026sort_by=\u0026order=\"\n  -H \"Content-Type: application/json\"\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\nThe available statuses to filter are: `overdue`, `completed`, `incomplete`.\n\n##### From a list\n\n```sh\ncurl -X GET \"http://localhost:3000/todo_lists/1/todos/1?status=\u0026sort_by=\u0026order=\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Edit to-do\n\nModify the content of the item.\n\n```sh\ncurl -X PUT \"http://localhost:3000/todos/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\" \\\n  -d '{\"todo\":{\"title\": \"Buy milk\"}}'\n```\n\n**Todo params:**\n* title: `string` `required`.\n* completed: `boolean` `optional`.\n\n##### In a list\n\n```sh\ncurl -X PUT \"http://localhost:3000/todo_lists/1/todos/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\" \\\n  -d '{\"todo\":{\"title\": \"Buy milk\"}}'\n```\n\n#### Mark to-do as completed\n\nChange the status to 'completed'.\n\n```sh\ncurl -X PUT \"http://localhost:3000/todos/1/complete\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n##### In a list\n\n```sh\ncurl -X PUT \"http://localhost:3000/todo_lists/1/todos/1/complete\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Mark to-do as incomplete\n\nChange the status to 'incomplete'.\n\n```sh\ncurl -X PUT \"http://localhost:3000/todos/1/incomplete\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n##### In a list\n\n```sh\ncurl -X PUT \"http://localhost:3000/todo_lists/1/todos/1/incomplete\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n#### Remove to-do\n\nThe item will be permanently deleted from the list\n\n```sh\ncurl -X DELETE \"http://localhost:3000/todos/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n\n##### From a list\n\n```sh\ncurl -X DELETE \"http://localhost:3000/todo_lists/1/todos/1\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer SOME-USER-TOKEN\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Frails_app_to_refactor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserradura%2Frails_app_to_refactor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Frails_app_to_refactor/lists"}