sudo apt-get update
sudo apt-get install git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev
sudo apt-get update
sudo apt-get install curl git
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
Para bash
echo '. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
Para zsh
echo '. $HOME/.asdf/asdf.sh' >> ~/.zshrc
echo '. $HOME/.asdf/completions/asdf.zsh' >> ~/.zshrc
Reiniciar o shell
source ~/.bashrc # ou source ~/.zshrc se você usa zsh
Verificar se o asdf foi instalado
asdf version
Adicionar plugin Ruby do asdf
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
Instalar ruby
asdf install ruby 3.3.2
asdf global ruby 3.3.2
Agora entra na pasta do projeto e roda esses comandos
bin/setup
bin/dev
rails s
Endpoint de cardápio do dia:
curl -H "Authorization: Token fD7WoV9ZH4qii8KsvwmNKUbSVfsm79rtjwuxgKuCae" \
-H "Content-Type: application/json" \
https://localhost:3000/api/v1/menus
Endpoint de criar um cliente:
curl -X POST http://localhost:3000/restaurants/1/customers \
-H "Content-Type: application/json" \
-H "Authorization: Token fD7WoV9ZH4qii8KsvwmNKUbSVfsm79rtjwuxgKuCae" \
-d '{
"customer": {
"name": "New Customer",
"phone": "123456789"
}
}'
Endpoint de criar um pedido:
curl -X POST http://localhost:3000/restaurants/1/orders \
-H "Content-Type: application/json" \
-H "Authorization: Token fD7WoV9ZH4qii8KsvwmNKUbSVfsm79rtjwuxgKuCae" \
-d '{
"order": {
"phone": "123456789",
"restaurant_id": 1,
"meal_box_id": 1,
"quantity": 2
}
}'