Skip to content

HammerRick/bouncer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bouncer

Rails api to check your credit score and potentially give you money!

Getting Started

Prerequisites

Preparing env variables

cp config/local_env_example.yml config/local_env.yml

Then adjust the keys as needed.

Installing

Install gems

bundle install

Create database

rails db:create

Run migrations

rails db:migrate

Make sure postgres is running, if your Linux distribution uses systemd, you can use:

systemctl status postgresql

If you need it, restart

systemctl restart postgresql

Run redis and sidekiq (in another shell)

redis-server
sidekiq

Run server

rails s

Example usage

To use application, send requests:

# get all loans with all data
curl --location --request GET 'http://localhost:3000/api/v1/loans'

# create loan
curl --location --request POST 'http://localhost:3000/api/v1/loans/' \
--header 'Content-Type: application/json' \
--data-raw '{ "loan" : {
        "name": "name",
        "cpf": "100.000.000-07",
        "birthdate": "1994-11-03",
        "amount": "1123.32",
        "terms": 6,
        "income": "3250.42"
    } }'

>{"id":"7e87b113-9edd-48f4-99e0-0b2d16d40042"}

# check loan result
curl --location --request GET 'http://localhost:3000/api/v1/loans/7e87b113-9edd-48f4-99e0-0b2d16d40042'
>{"id":"7e87b113-9edd-48f4-99e0-0b2d16d40042","amount":"1123.32","status":"completed","result":"approved","refused_policy":null,"approved_terms":9}

Running tests

With our development container running, type:

bundle exec rspec

About

Rails Loans api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published