Code Monkey home page Code Monkey logo

test_bank's Introduction

VisableBank app

Build Status

Main requirements for this app.

  1. You need to transfer funds between accounts. Think about what classes and DB tables you need for this task. Implement the models and a service class that wires them together.
  2. Build a REST endpoint to show the balance of the account and 10 latest transactions.
  3. Build a REST endpoint to transfer money between accounts. Your REST action should use the service class you built in task 1.

Framework and language dependencies:

  • Rails version: 6.0
  • Ruby version: 2.5.3
  • PostgreSql: 9.6
  • SQLite for development environment only

How to configure application

For development environment you don't need to do anything.

For production environment you need to setup PostgreSQL connection credential in .env.production file.

Here is the example:

RDS_HOST=localhost
RDS_DATABASE=visable_development
RDS_USER=visable_user
RDS_PASSWORD=<STRONG PASSWORD>

How to run

  gem install bundler
  bundle install
  • Make sure all tests are passes on your environment
  bundle exec rspec
  • Start rails
  bundle exec rails db:create
  bundle exec rails db:migrate
  bundle exec rails s

Development

You can create some test data on your local environment with following command

  bundle exec rails db:create
  bundle exec rails db:migrate
  bundle exec rails db:seed
  bundle exec rails s

Then you test with curl as like following examples:

Last 10 transaction list

curl localhost:3000/transactions

Or specify limit with 1

curl localhost:3000/transactions?limit_number=1

Do some transfer with curl

 curl -X POST -H "Content-Type: application/json" -d '{"account_from":"2", "account_to":"4", "transfer_amount": "100"}' localhost:3000/transactions/transfer

TODO

  1. Add more edge case tests
  2. Create Docker compose file for local environment
  3. Create API document with Swagger

test_bank's People

Contributors

zogoo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.