Make your art dance with SHOOP.
- Shoop App: https://sjruby.github.io/wdi-client-project-two/index.html
- Shoop Client Repo: https://github.com/sjruby/wdi-client-project-two
Shoop allows users to generate random patters of two colors on a 28x28 grid. Further it allows users to animate the board according Conways Game Of Life Rules.
The final ERD is below: Imgur
rspec testing has been set up for the Boards resources requests, routes,
- Create a
.env
for sensitive settings (touch .env
). - Generate new
development
andtest
secrets (bundle exec rake secret
). - Store them in
.env
with keysSECRET_KEY_BASE_<DEVELOPMENT|TEST>
respectively.
Below are the authentication actions and associated Sriptes
Verb | URI Pattern | Controller#Action |
---|---|---|
POST | /sign-up |
users#signup |
POST | /sign-in |
users#signin |
PATCH | /change-password/:id |
users#changepw |
DELETE | /sign-out/:id |
users#signout |
Request:
curl http://localhost:4741/sign-up \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'"${EMAIL}"'",
"password": "'"${PASSWORD}"'",
"password_confirmation": "'"${PASSWORD}"'"
}
}'
EMAIL=ava@bob.com PASSWORD=hannah scripts/sign-up.sh
Response:
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 1,
"email": "ava@bob.com"
}
}
Request:
curl http://localhost:4741/sign-in \
--include \
--request POST \
--header "Content-Type: application/json" \
--data '{
"credentials": {
"email": "'"${EMAIL}"'",
"password": "'"${PASSWORD}"'"
}
}'
EMAIL=ava@bob.com PASSWORD=hannah scripts/sign-in.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 1,
"email": "ava@bob.com",
"token": "BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f"
}
}
Request:
curl --include --request PATCH "http://localhost:4741/change-password/$ID" \
--header "Authorization: Token token=$TOKEN" \
--header "Content-Type: application/json" \
--data '{
"passwords": {
"old": "'"${OLDPW}"'",
"new": "'"${NEWPW}"'"
}
}'
ID=1 OLDPW=hannah NEWPW=elle TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/change-password.sh
Response:
HTTP/1.1 204 No Content
Request:
curl http://localhost:4741/sign-out/$ID \
--include \
--request DELETE \
--header "Authorization: Token token=$TOKEN"
ID=1 TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/sign-out.sh
Response:
HTTP/1.1 204 No Content
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /users |
users#index |
GET | /users/1 |
users#show |
Request:
curl http://localhost:4741/users \
--include \
--request GET \
--header "Authorization: Token token=$TOKEN"
TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/users.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"users": [
{
"id": 2,
"email": "bob@ava.com"
},
{
"id": 1,
"email": "ava@bob.com"
}
]
}
Request:
curl --include --request GET http://localhost:4741/users/$ID \
--header "Authorization: Token token=$TOKEN"
ID=2 TOKEN=BAhJIiVlZDIwZTMzMzQzODg5NTBmYjZlNjRlZDZlNzYxYzU2ZAY6BkVG--7e7f77f974edcf5e4887b56918f34cd9fe293b9f scripts/user.sh
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"user": {
"id": 2,
"email": "bob@ava.com"
}
}
Below are the actions associated with CRUDING on the Boards resource
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | `/list-boards' | boards#index |
GET | /boards/1 |
boards#show |
POST | /boards |
boards#create |
PATCH | /boards/1 |
boards#show |
DELETE | /boards/1 |
boards#show |
Request:
curl --include --request GET https://protected-ridge-58465.herokuapp.com/boards \
--header "Authorization: Token token=3481054d61508f98d6c40aeccfeacaa2" \
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"boards": [
{
"id": 2,
"title": "test"
"cells":"[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]"
},
{
"id": 2,
"title": "NewBoard"
"cells":"[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]"
}
]
}
Below are the actions associated with CRUDING on the Boards resource
Verb | URI Pattern | Controller#Action |
---|---|---|
GET | /boards |
boards#index |
GET | /boards/1 |
boards#show |
POST | /boards |
boards#create |
PATCH | /boards/1 |
boards#show |
DELETE | /boards/1 |
boards#show |
Request:
curl --include --request GET https://protected-ridge-58465.herokuapp.com/boards \
--header "Authorization: Token token=3481054d61508f98d6c40aeccfeacaa2" \
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"boards": [
{
"id": 2,
"title": "test"
"cells":"[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]"
},
{
"id": 2,
"title": "NewBoard"
"cells":"[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]"
}
]
}
Request:
curl --include --request GET https://protected-ridge-58465.herokuapp.com/boards/2 \
--header "Authorization: Token token=3481054d61508f98d6c40aeccfeacaa2" \
Response:
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"board": [
{
"id": 2,
"title": "test"
"cells":"[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]"
}
}
Request:
curl --include --request POST https://protected-ridge-58465.herokuapp.com/boards \
--header "Authorization: Token token=3481054d61508f98d6c40aeccfeacaa2" \
--data '{
"board": {
"title": "Ima board",
"cells": ""[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]""
}
}'
Response:
HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
{
"board": {
"title": "Ima board",
"cells": "[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]"
}
}
Request:
curl --include --request PATCH https://protected-ridge-58465.herokuapp.com/boards \
--header "Authorization: Token token=3481054d61508f98d6c40aeccfeacaa2" \
--data '{
"board": {
"title": "Ima UPDATED BOARD",
"cells": ""[[{\"xCord\":0,\"yCord\":0,\"intialValue\":2},{\"xCord\":0,\"yCord\":1,\"intialValue\":1},{\"xCord\":0,\"yCord\":2,\"intialValue\":2}]]""
}
}'
Response:
HTTP/1.1 204 No Content
Request:
curl --include --request DELETE https://protected-ridge-58465.herokuapp.com/boards/1 \
--header "Authorization: Token token=3481054d61508f98d6c40aeccfeacaa2" \
Response:
HTTP/1.1 204 No Content