ClarkBank / clark_api

The Clark Bank API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clark API

  • Rails API for Clark Bank Application
  • Rails 5 API with minimal dependencies and middlewares
  • A minimal docker alpine container
  • Automatically pushes it to dockerhub if tests pass

Installation

git clone https://github.com/ClarkBank/clark_api.git
cd clark_api
bundle
rails s

Triggering Events

In order to trigger events you must to create a vhost on rabbitmq admin, login as user:guest pass:guest, create the vhost events and set guest permission for it.

API

Create User

curl -H 'Content-Type: application/json' -d '{"email": "test@mail.com", "password": "12345678"}' -X POST 'http://localhost:9292/registrations'

Open a new Bank Account

curl -H 'Content-Type: application/json' -d '{"name": "City Bank", "user_id": 1}' -H "Authorization: Bearer <ACCESS_TOKEN>" -X POST 'http://localhost:9292/accounts'

Deposit into Account

curl -H 'Content-Type: application/json' -d '{"amount": 9.99}' -H "Authorization: Bearer <ACCESS_TOKEN>" -X POST 'http://localhost:9292/accounts/123456/deposit'

Withdraw from Account

curl -H 'Content-Type: application/json' -d '{"amount": 9.99}' -H "Authorization: Bearer <ACCESS_TOKEN>" -X POST 'http://localhost:9292/accounts/123456/withdraw'

Transfer from one Account to Another account

curl -H 'Content-Type: application/json' -d '{"recipient_id": "654321", "amount": 9.99}' -H "Authorization: Bearer <ACCESS_TOKEN>" -X POST 'http://localhost:9292/accounts/123456/transfer'

Docker

This repository has automated image builds on hub.docker.com after successfully building and testing. See the deployment section of circle.yml for details on how this is done. Note that three environment variables need to be set on CircleCI for the deployment to work:

  • DOCKER_EMAIL - The email address associated with the user with push access to the Docker Hub repository
  • DOCKER_USER - Docker Hub username
  • DOCKER_PASS - Docker Hub password (these are all stored encrypted on CircleCI, and you can create a deployment user with limited permission on Docker Hub if you like)

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

Badges

CircleCI Code Climate Test Coverage Issue Count


GitHub @rafaeljesus  ·  Twitter @rafaeljesus

About

The Clark Bank API


Languages

Language:Ruby 100.0%