Git Product home page Git Product logo

banking-api's Introduction

Bank API Challenge

This is the solution for a job application challenge.

See the challenge file for a specific description about it and details about the implementation.

Description

This is a REST API made with Ruby on Rails that exposes 4 endpoints:

- POST /login

Parameters:

email: string
password: string

- DELETE /logout

Parameters:

email: string

- POST /transfer

Parameters:

"client_id": integer,
"source_account_id": integer,
"destination_account_id": integer,
"amount": integer

- GET /balance

Parameters:

id: integer

Using the API

The following are examples on how you can send requests against the API the Curl terminal tool.

Feel free to use any HTTP client of your preference, though.

** Note that these examples use seed data already fed into the database when you start the API server. This also assumes you started the API on the default 3000 port on your local environment * *

  • Logging in
curl -i -H Content-Type\:\ application/json -XPOST http\://localhost\:3000/login -d \{'
'\ \ \ \ \"email\"\:\ \"tobias\@email.com\"\,'
'\ \ \ \ \"password\"\:\ \"encpass2\"'
'\}'
'
  • Logging out
curl -i -H Content-Type\:\ application/json -XDELETE http\://localhost\:3000/logout -d \{'
'\ \ \ \ \"email\"\:\ \"tobias\@email.com\"'
'\}'
'
  • Getting an account balance
curl -i -XGET http\://localhost\:3000/balance\?id\=1
  • Making a transfer
curl -i -H Content-Type\:\ application/json -XPOST http\://localhost\:3000/transfer -d \{'
'\ \ \ \ \"client_id\"\:\ 2\,'
'\ \ \ \ \"source_account_id\"\:\ 2\,'
'\ \ \ \ \"destination_account_id\"\:\ 3\,'
'\ \ \ \ \"amount\"\:\ 5000'
'\}'
'

Contributing

See the contributing file.

License

Apache License, Version 2.0 © Gustavo P Borges

banking-api's People

Contributors

gugutz avatar

Watchers

James Cloos 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.