- Ruby 3.0.1
- Rails 6.1.4
- Ngrok
- Postgres
In this project an API is listening and saving Github webhook events data in a Postgres database. For that, new opened Github issues and its comments are being monitored in this repository and sent to the local project if it is configured, or to the production app. To configure a webhook we used the following tutorial made available by Github. The project also allows retrieving the persisted events using basic authentication.
P.s.: The production app does not return any visual feedback.
See the Production link
session to use.
git clone https://github.com/axelzito/jaya-challenge.git project_name
cd project_name
bundle install
sudo -u postgres createuser -s $USER -P
rails db:create
If the below step return any erro, try this:
sudo -u postgres psql
\password
Set your password, and try again:
rails db:create
rails db:migrate
cp .env.example .env
sudo snap install ngrok
To generate a public url that will route to your local host do:
sudo ngrok http 4000
In your config/environments/development.rb
file, add a line with the ngrok url
config.hosts << 'xxxx-xxx-xxx-xxx-xxx.ngrok.io'
rails s -p 4000
To run the tests, just run the command:
rspec
This project is running in Heroku with automatically deploys from master branch after pass in CI with Github Actions.
To test, just create an issue or comment in existent issue in this repository.
It is necessary to use Basic Authentication
Username: xxx
Password: xxx
To return all issues, just run
GET https://jaya-challenge-axel.herokuapp.com/api/issues/
[
{
"id": 1,
"action": "created",
"created_at": "2021-11-06T20:00:07.981Z",
"updated_at": "2021-11-06T20:00:07.981Z"
},
{
"id": 2,
"action": "edited",
"created_at": "2021-11-06T20:04:09.061Z",
"updated_at": "2021-11-06T20:04:09.061Z"
}
]
To return a specific issue, just run
GET https://jaya-challenge-axel.herokuapp.com/api/issues/:id
To return a full event from a specific issues, just run
GET https://jaya-challenge-axel.herokuapp.com/api/issues/:id/events
It is necessary to use Basic Authentication
Username: xxx
Password: xxx
by Axel Miguez