{"id":15151432,"url":"https://github.com/erivandosena/api-ruby","last_synced_at":"2026-02-05T05:34:25.479Z","repository":{"id":180497681,"uuid":"665237246","full_name":"erivandosena/api-ruby","owner":"erivandosena","description":"RESTful API with Ruby on Rails","archived":false,"fork":false,"pushed_at":"2023-07-17T04:22:47.000Z","size":81,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-07-16T02:12:25.075Z","etag":null,"topics":["api-restful","devise","docker","docker-compose","doorkeeper","nginx","oauth2","passenger","rails7","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erivandosena.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-07-11T18:46:14.000Z","updated_at":"2023-07-17T04:22:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"c70707f9-ea8e-4a49-8f25-f7534b656a49","html_url":"https://github.com/erivandosena/api-ruby","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"771ea222f583b36aaff85bff36110ce16a000517"},"previous_names":["erivandosena/api-ruby"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erivandosena/api-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erivandosena%2Fapi-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erivandosena%2Fapi-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erivandosena%2Fapi-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erivandosena%2Fapi-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erivandosena","download_url":"https://codeload.github.com/erivandosena/api-ruby/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erivandosena%2Fapi-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29113716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-restful","devise","docker","docker-compose","doorkeeper","nginx","oauth2","passenger","rails7","ruby"],"created_at":"2024-09-26T15:02:27.396Z","updated_at":"2026-02-05T05:34:25.462Z","avatar_url":"https://github.com/erivandosena.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"\" rel=\"noopener\"\u003e\n \u003cimg width=200px height=200px src=\"https://i.imgur.com/FxL5qM0.jpg\" alt=\"Bot logo\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003eAPI Ruby on Rails\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Status](https://img.shields.io/badge/status-active-success.svg)]() [![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\n\n\u003c/div\u003e\n\n---\n\n\u003cp align=\"center\"\u003e 🤖 RESTful API with Ruby on Rails\n    \u003cbr\u003e \n\u003c/p\u003e\n\nEndpoint API: http://localhost:8002/api/v1\nEndpoint DOC: http://localhost:8002/api/v1/api-docs/\n\n## 📝 Table of Contents\n\n- [Rotas](#rotas)\n      - [http://localhost:8002/api/v1](#httplocalhost8002apiv1)\n      - [http://localhost:8002/api/v1/api-docs/](#httplocalhost8002apiv1api-docs)\n    - [Listar todas as páginas](#listar-todas-as-páginas)\n  - [Install Docker](#install-docker)\n      - [To Install Docker in WSL/2](#to-install-docker-in-wsl2)\n    - [Installing](#installing)\n    - [Example:](#example)\n  - [🏁 Getting Started ](#-getting-started-)\n    - [Prerequisites](#prerequisites)\n    - [Installing](#installing-1)\n        - [Build image:](#build-image)\n        - [Compose V2 (para Compose V1 use: docker-compose ...):](#compose-v2-para-compose-v1-use-docker-compose-)\n  - [🚀 Deploying your API ](#-deploying-your-api-)\n    - [Rotas:](#rotas-1)\n  - [⛏️ Built Using ](#️-built-using-)\n  - [✍️ Authors ](#️-authors-)\n  - [🎉 Acknowledgements ](#-acknowledgements-)\n\n## 🧐 About \u003ca name = \"about\"\u003e\u003c/a\u003e\n\nA RESTful API ultimately lives on the Web, or on a communication network where different parties can expose and consume data streams.\n\n## 🎥 Application Sample / Working \u003ca name = \"demo\"\u003e\u003c/a\u003e\n\n![Working](https://media.giphy.com/media/20NLMBm0BkUOwNljwv/giphy.gif)\n\n## 💭 How it works \u003ca name = \"working\"\u003e\u003c/a\u003e\n\nThe entire API is written in Ruby 3.1.1\n\n## 🎈 Usage \u003ca name = \"usage\"\u003e\u003c/a\u003e\n\n# Rotas\n#### http: //domain/api/v1\n### Listar todos recursos\nRetorna uma lista de todos os recursos cadastrados.  \n**GET** `/api/v1/pages` \n\n### Obter um recurso específico\nRetorna os detalhes de um recurso específico com base no ID fornecido.  \n**GET** `/api/v1/pages/:id`\nParâmetros  \n- `:id` (obrigatório): O ID do recurso desejado.  \n\n### Criar um novo recurso\nCria um novo recurso com os dados fornecidos.\n**POST** `/api/v1/pages`\nParâmetros da Requisição  \n- `page` (obrigatório): Um objeto JSON contendo os detalhes do recurso a ser criado.  \nOs campos obrigatórios são `title`, `description` e `active`.  \n***Exemplo de requisição***\n```json\n{\n  \"page\": {\n    \"title\": \"Novo Artigo\",\n    \"description\": \"Texto descritivo do novo artigo.\",\n    \"active\": true\n  }\n}\n```\n### Atualizar uma página existente\nAtualiza os detalhes de um recurso existente com base no ID fornecido.  \n**PATCH/PUT** `/api/v1/pages/:id`\nParâmetros  \n- `:id` (obrigatório): O ID do recurso a ser atualizado.  \nParâmetros da Requisição  \n- `page` (obrigatório): Um objeto JSON contendo os detalhes atualizados do recurso. \nOs campos permitidos para atualização são title, description e active.  \n***Exemplo de requisição***\n```json\n{\n  \"page\": {\n    \"title\": \"Atualização do artigo\",\n    \"description\": \"Texto descritivo com atualização desativado.\",\n    \"active\": false\n  }\n}\n```\n### Excluir uma página\nExclui um recurso existente com base no ID fornecido.  \n**DELETE** `/api/v1/pages/:id` \nParâmetros  \n- `:id` (obrigatório): O ID do recurso a ser excluído.\n\n### Erros\nA API retorna os respectivos textos de erros, mensagens e validações:  \n***Exemplo de respostas:***\n```json\n{\n  \"error\": \"Recurso não encontrado\"\n}\n```\n```json\n{\n  \"error\": \"404 Not Found: Endpoint inexistente para o recurso.\"\n}\n```\n```json\n{\n  \"message\": \"Bem-vindo à API RESTful Ruby on Rails\"\n}\n```\n```json\n{\n    \"title\": [\n        \"não pode ficar em branco\"\n    ],\n    \"description\": [\n        \"não pode ficar em branco\"\n    ],\n    \"active\": [\n        \"não está incluído na lista\"\n    ]\n}\n```\n\n## Install Docker\n```bash\ncurl https://releases.rancher.com/install-docker/20.10.sh | sh\n```\n#### To Install Docker in WSL/2\n```bash\necho 'sudo gpasswd -a $USER docker' \u003e\u003e ~/.bashrc\necho 'sudo chmod 666 /var/run/docker.sock' \u003e\u003e ~/.bashrc\necho 'sudo /etc/init.d/docker start' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n### Installing\n\nA step by step series of examples that tell you how to get a development env running.\n\n```bash\necho \"# api-ruby\" \u003e\u003e README.md\ngit init\ngit add README.md\ngit commit -m \"Next commit\"\ngit branch -M main\ngit remote add origin https://github.com/erivandosena/api-ruby.git\ngit push -u origin main\n```\n\nSend to repository\n\n```bash\ngit remote add origin https://github.com/erivandosena/api-ruby.git\ngit branch -M main\ngit push -u origin main\n```\n\nClean Docker Workspace local \n\n```bash\ndocker stop $(docker ps -qa)\ndocker rm -f $(docker ps -qa)\ndocker rmi -f $(docker images -qa)\ndocker volume rm -f $(docker volume ls -q)\ndocker network rm $(docker network ls -q)\ndocker system prune -fa\n```\n\n### Installing Docs  \n**Gemfile**  \ngem 'grape-swagger-rails'  \ngem 'rswag-api'  \ngem 'rswag-ui'  \n\n```bash\nbundle install\n```\n\n**Install generators/customizing**  \n```bash\nrails g rswag:api:install  \nrails g rswag:ui:install  \nrails g rswag:ui:custom  \n```\n\n### User\n\n```bash\nrails g controller User email:string password_digest:string\n\nrails g model User email:string password_digest:string\n\nrails g model ApiKey bearer_id:integer bearer_type:string token:string\n```\n\n#### Função HMAC para chave secreta\n```bash\nAPI_KEY_HMAC_SECRET_KEY=$(bundle exec bin/rails runner \"puts SecureRandom.hex(32)\")\n```\n\n#### Add user  \n```bash\ndocker exec -it api-ruby bin/rails runner 'User.create!(email: \"admin@admin.com\", password: \"1234\")'\n```\n\n#### Create Token API  \n```bash\ncurl -v -X POST http://localhost:8002/api/v1/api-keys -u admin@admin.com:1234\n```\n***Exemplo de resposta:***  \n```json\n{\n\t\"api_key\": \"1febeb9cd6babc872e81eefe349062a2\"\n}\n```\n\n#### Modelos de solicitações para API REST  \n```bash\ncurl -v -X GET http://localhost:8002/api/v1/api-keys -H 'Authorization: Bearer 1febeb9cd6babc872e81eefe349062a2'\n\ncurl -v -X GET http://localhost:8002/api/v1/users -H 'Authorization: Bearer 1febeb9cd6babc872e81eefe349062a2'\n\ncurl -v -X GET http://localhost:8002/api/v1/pages -H 'Authorization: Bearer 1febeb9cd6babc872e81eefe349062a2'\n\ncurl -v -X DELETE http://localhost:8002/api/v1/api-keys/1 -H 'Authorization: Bearer 1febeb9cd6babc872e81eefe349062a2'\n```\n\n### Example:\n\n\u003e !dict what is love\n\n**Definition:**\n\nBaby, dont hurt me~\nDont hurt me~ no more.\n\n**Example:**\n\nDude1: Bruh, what is love?\nDude2: Baby, dont hurt me, dont hurt me- no more!\nDude1: dafuq?\n\n**Source:** https://github.com/erivandosena/api-ruby\n\n---\n\n\u003csup\u003eBeep boop. I am a API. If there are any issues, contact my [Main](https://hub.docker.com/r/erivando/api-ruby)\u003c/sup\u003e\n\n\u003csup\u003eWant to make a similar reddit API? Check out: [GitHub](https://github.com/erivandosena/api-ruby)\u003c/sup\u003e\n\n## 🏁 Getting Started \u003ca name = \"getting_started\"\u003e\u003c/a\u003e\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See [deployment](#deployment) for notes on how to deploy the project on a live system.\n\n### Prerequisites\nDocker  \nLinux Debian  \nRuby on Rails  \nNginx Server  \nPassenger  \nOAuth2  \nDevise  \nDoorkeeper  \nRswag  \nSwagger  \nPosgreSQL  \nRedis  \n\n```cmd\nRails version: 7.0.6\nRuby version: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux]\n```\n\n### Installing\n\n##### Build image:\n```bash\ndocker build -f ./Dockerfile -t erivando/api-ruby:latest --build-arg VERSION=1.0.0 --build-arg COMMIT_SHA=$(git rev-parse HEAD) --no-cache .\ndocker tag erivando/api-ruby:latest erivando/api-ruby:v1.0.0\ndocker login\ndocker push erivando/api-ruby:v1.0.0\n```\n\n##### Compose V2 (para Compose V1 use: docker-compose ...):\n```bash\ndocker compose build --no-cache \u0026\u0026 docker compose up -d\ndocker compose exec api-ruby bash\ndocker compose logs -f -t api-ruby\ndocker compose down\n```\n\n## 🚀 Deploying your API \u003ca name = \"deployment\"\u003e\u003c/a\u003e\n\nGerar modelo Page com os atributos `title` (string), `description` (text), `active` (boolean).   \nTambém irá gerar automaticamente o controlador, as rotas e os testes correspondentes para API. \n\n```bash\nrails new api_crud -v 3.1.1 --api --skip-bundle --version=7.0.6 -d postgresql\nrails g scaffold Page title:string description:text active:boolean\n```\n\n- **Docker**: https://hub.docker.com/r/erivando/api-ruby\n\n## ⛏️ Built Using \u003ca name = \"built_using\"\u003e\u003c/a\u003e\n\n- [PRAW](https://praw.readthedocs.io/en/latest/) - Python Reddit API Wrapper\n\n## ✍️ Authors \u003ca name = \"authors\"\u003e\u003c/a\u003e\n\n- [@erivandosena](https://github.com/erivandosena) - Idea \u0026 Initial work\n\n## 🎉 Acknowledgements \u003ca name = \"acknowledgement\"\u003e\u003c/a\u003e\n\n- Hat tip to anyone whose code was used\n- Inspiration\n- References","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferivandosena%2Fapi-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferivandosena%2Fapi-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferivandosena%2Fapi-ruby/lists"}