Requirement
- docker
- docker-compose
- rails ^6.0.3
- ruby 3.0.3
- Install git
- Install rbenv https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-20-04
- rbenv install 3.0.3
- Install docker https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-20-04
- Install docker-compose https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-20-04
- Git Clone
- copy .env file from .env.example
- docker-compose build
- copy master.key from master-example.key
- docker-compose up --detach
- docker-compose exec web rails db:setup
- docker-compose exec web rails db:seed
localhost:3000/login
localhost:3000/logout
localhost:3000
[POST] localhost:3000/api/session
Keys | Values |
---|---|
user[username] | user1 |
user[password] | password |
[DELETE] localhost:3000/api/session
[POST] localhost:3000/api/transfer
Keys | Values |
---|---|
transaction[receiver_id] | user_id |
transaction[amount] | amount |
[POST] localhost:3000/api/withdraw
Keys | Values |
---|---|
transaction[amount] | amount |
-
run
rails console
ordocker-compose exec web rails console
-
run
load "#{Rails.root}/lib/latest_stock_price/client.rb"
-
run
LatestStockPrice::Client.new.price("NIFTY%2050")
- indices values "NIFTY%2050", "NIFTY%20NEXT%2050", "NIFTY%20100", "NIFTY%20500"
-
run
LatestStockPrice::Client.new.price_all