Let's change the subject is an app that facilitates conversations big and small between friends, coworkers, partners and strangers by suggesting conversation prompts.
- Getting Started
- Installation
- Start and Watch
- Domain Model
- Endpoints and Sample Responses
- Languages and tools
- Contributing
- License
For development, you will only need Ruby on Rails and Postgres, which depends on Homebrew and Ruby.
You will need to use a Terminal. On OS X, you can find the default terminal in
/Applications/Utilities/Terminal.app
.
-
Install Homebrew:
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Install Ruby:
$ brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile
# Install Ruby
$ rbenv install 2.7.1
$ rbenv global 2.7.1
$ ruby -v
- Install Rails
$ gem install rails -v 6.0.2.2
- Install PostgreSQL
$ brew install postgresql
Go on official Rails website & follow the steps.
Go on official Rails website & follow the steps.
- Clone the repo and cd into the folder:
$ git clone https://github.com/luanesouza/backend-lets-change-the-subject.git
$ cd backend-lets-change-the-subject
- Install dependencies (gems)
$ bundle
- Create migrations, migrate and seed:
$ rails db:create
$ rails db:migrate
$ rails db:seed
$ rails s
This app uses API versioning. Currently, the calls can be made to /api/v1/
. Below you will find available endpoints with sample responses:
Endpoint: GET /api/v1/questions
Action description: Response will consist of 50 random questions from all categories
Sample response:
[
{
"id": 111,
"content": "What fictional character is amazing in their book / show / movie, but would be insufferable if you had to deal with them in mundane everyday situations?",
"additionalLink": "https://conversationstartersworld.com",
"spiciness": 1
},
{
"id": 130,
"content": "If you were given an envelope with the the time and date of your death inside, would you open it?",
"additionalLink": "https://conversationstartersworld.com",
"spiciness": 1
}
]
Endpoint: GET /api/v1/categories
Action description: Response will consist of all currently available categories.
Sample response:
[
{
"name": "friends"
},
{
"name": "coworkers"
}
]
Endpoint: GET /api/v1/categories/name-of-the-category
Action description: Response will contain 50 random questions from the given category.
Sample response:
{
"name": "friends",
"questions": [
{
"id": 77,
"spiciness": 1,
"additionalLink": "",
"content": "What's the most embarrasing thing you've ever said?"
},
{
"id": 43,
"spiciness": 1,
"additionalLink": "",
"content": "What is a thing you always wanted to learn but never got around to?"
},
]
}
Endpoint: GET /api/v1/users/:id
Action description: Response will provide information about the user, together with 100 random questions from each category that the user has not yet seen.
Sample response:
{
"id": 1,
"email": "xyz2020@gmail.com",
"username": "xyz2020",
"remainingFriendsQs": [
{
"id": 4,
"spiciness": 2,
"additionalLink": "https://ggia.berkeley.edu/practice/36_questions_for_increasing_closeness",
"content": "Would you like to be famous? In what way?"
},
],
"remainingCoworkersQs": [
{
"id": 78,
"spiciness": 1,
"additionalLink": "",
"content": "If you could have two of a body part, which one would you duplicate and why?"
},
],
"remainingPartnersQs": [
{
"id": 25,
"spiciness": 1,
"additionalLink": "https://ggia.berkeley.edu/practice/36_questions_for_increasing_closeness",
"content": "Alternate sharing something you consider a positive characteristic of your partner. Share a total of five items."
},
]
}
Endpoint: POST /api/v1/seen_questions
Action description: The body of the requests needs to contain: user_id, question_id and, in case the question was skipped, skipped: true
.
Sample OK response:
tba
Sample error response:
tba
Endpoint: POST /api/v1/users
Action description: The body of the requests needs to contain: username, password, password_confirmation and email and these params need to be in accordance with our validations.
Sample OK response:
tba
Sample error response:
tba
Endpoint: POST /api/v1/auth/login
Action description: The body of the requests needs to contain: username and password.
Sample OK response:
tba
Sample error response:
tba
Endpoint: GET /api/v1/auth/auto_login
Action description: The body of the requests needs to contain a token.
Sample OK response:
tba
Sample 401 error response:
{
"message": "Please log in"
}
- Ruby on Rails
- PostgreSQL - database
- JWT - auth web tokens
- Active Record - Object Relational Mapping system
- Active Model Serializers - serialization
Pull requests are welcome. Please make sure that your PR is well-scoped. For major changes, please open an issue first to discuss what you would like to change.
Visit issues section.
Sylwia Vargas 💻 🐛📖💡 |
Annie Souza 🚇 🐛💡 |