Idea Pool is a service that records your ideas! After signing up for an account, users can log their ideas and assign them scores. Every idea contains 3 scores: Impact, Ease and Confidence. Each idea can be added, edited and deleted. All the ideas will be sorted by the average of all three scores. Every API call will return 10 ideas. When not using the service, users can log out of the system.
- Getting Started
- Dependencies
- Tests
- API Endpoints
- Responses
- Error handling
- Versions
- Request & Response Examples
- Contributing
Clone the repository:
$ git clone https://github.com/akabiru/idea_pool && cd $_
Install the dependencies
$ bundle install
Setup the database & Redis store:
$ bundle exec rails db:setup
$ brew services start redis # on MacOS
The above will get you a copy of the project up and running on your local machine for development and testing purposes.
$ bundle exec rspec -fd
$ http https://infinite-dusk-17447.herokuapp.com/ideas Authorization: "Bearer eyJ0eXAiOiJ..."
EndPoint | Functionality |
---|---|
POST /users | Signup a user |
POST /access-tokens | Login user |
POST /access-tokens/Refresh | Refresh token (Header X-Refresh-Token) |
DELETE /access-tokens | Logout user |
POST /ideas | Create a new bucket list |
GET /ideas/ | List all the created bucket lists |
GET /ideas?page=1&limit=5 | List five ideas from page 1 |
GET /ideas/:id | Get single idea |
PUT /ideas/:id | Update this idea |
DELETE /ideas/:id | Delete this single idea |
POST /signup
$ echo '{"email": "jack-black@codementor.io","name": "Jack Black","password": "the-Secret-123"}' | http https://infinite-dusk-17447.herokuapp.com/users
POST /access-tokens (Login)
$ echo '{"email": "jack-black@codementor.io","password": "the-Secret-123"}' | http https://infinite-dusk-17447.herokuapp.com/access-tokens
POST /access-tokens/refresh
$ http POST https://infinite-dusk-17447.herokuapp.com/access-tokens/refresh X-Refresh-Token: 'ashdahskjdhak....'
DELETE /access-tokens (Logout)
$ http DELETE https://infinite-dusk-17447.herokuapp.com/access-tokens X-Refresh-Token: 'ashdahskjdhak....'
POST /ideas
$ echo '{"content": "the-content","impact": 8,"ease": 8,"confidence": 8}' | http POST https://infinite-dusk-17447.herokuapp.com/ideas Authorization: 'Bearer hajsdhkasd'
GET /ideas
$ http https://infinite-dusk-17447.herokuapp.com/ideas page==1 Authorization: 'Bearer hajsdhkasd'
GET /ideas/:id
$ http https://infinite-dusk-17447.herokuapp.com/ideas/1 Authorization: 'Bearer hajsdhkasd'
PUT /ideas/:id
$ echo '{"impact": 10}' | http PUT https://infinite-dusk-17447.herokuapp.com/ideas/1 Authorization: 'Bearer hajsdhkasd'
DELETE /ideas/:id
$ http DELETE https://infinite-dusk-17447.herokuapp.com/ideas/1 Authorization: 'Bearer hajsdhkasd'
The API responds with JSON data by default.
The API responds with an error message and http status code whenenever it encounters an error.
{
"message": "Signature has expired"
}
TODO:
Request GET /ideas?page=2&limit=2
$ http https://infinite-dusk-17447.herokuapp.com/ideas?page=2&limit=2 \
Authorization: 'Bearer eyJ0eXAiOiJKV...'
Response (application/json)
[
{
"id": 1,
"confidence": 8,
"ease": 8,
"impact": 8,
"content": "Idea",
"user_id": 2,
"created_at": "2018-08-30T10:08:08.876Z",
"updated_at": "2018-08-30T10:08:08.904Z",
"average_score": 8.0
},
{
"id": 2,
"confidence": 8,
"ease": 8,
"impact": 8,
"content": "Idea",
"user_id": 2,
"created_at": "2018-08-30T10:08:10.646Z",
"updated_at": "2018-08-30T10:08:10.649Z",
"average_score": 8.0
},
]
- Fork it! 🍴
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git add -A && git commit -m 'Add some feature'
- Push to the branch:
git push origin my-new-feature
🚀 - Submit a pull request 😎
This project is licensed under the MIT License - see the LICENSE.md file for details