Project

kaspay

0.0
No commit activity in last 3 years
No release in over 3 years
A gem to access KasPay web using watir gem and X virtual framebuffer wrapped by headless gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 2.2.0, ~> 2.2
>= 5.0.0, ~> 5.0
 Project Readme

KasPay

Description

A ruby library to access KasPay with your account.

Installation

Install the X virtual framebuffer that we will use to run the Watir::Browser

sudo apt-get install xvfb     

and then:

gem install kaspay    

Usage

Put this code wherever you're going to use it:

require 'kaspay'  

In Gemfile:

gem 'kaspay'

Examples

Code

require 'kaspay'

kaspay = KasPay.login email: "email@example.com", password: "yOurp@sSw0rD"
# Alternative:
# kaspay = KasPay.login
# kaspay.email = "email@example.com"
# kaspay.password = "yOurp@sSw0rD"
puts "#{kaspay.get_name}'s savings with account number #{kaspay.get_acc_num}:"
# `<method>` is an alias for `get_<method>`. So, you can use `kaspay.name` or `kaspay.acc_num` instead.
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
puts " Bank A balance".ljust(15) + ": " + "Rp 500,000.00".rjust(20)
puts " Bank B balance".ljust(15) + ": " + "Rp 600,000.00".rjust(20)
puts " KasPay balance".ljust(15) + ": " + kaspay.get_balance.to_s.rjust(20)
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
puts " Total balance".ljust(15) + ": " + (kaspay.balance + 500000 + KasPay::Money.new(600000)).to_s.rjust(20)
puts "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
kaspay.logout!

Output

#=> John Doe's savings with account number 12345678:
#=> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#=>  Bank A balance:        Rp 500,000.00
#=>  Bank B balance:        Rp 600,000.00
#=>  KasPay balance:        Rp 915,826.00
#=> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#=>  Total balance :      Rp 2,015,826.00
#=> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~