class Coinone::Account::Balance
Attributes
btc[R]
etc[R]
eth[R]
normal_wallets[R]
result[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/coinone/account/balance.rb, line 13 def initialize(options={}) @result = options[:result] || nil @normal_wallets = [] @btc = Wallet.new() @eth = Wallet.new() @etc = Wallet.new() keys = [:normalWallets, :btc, :eth, :eth] update_balance(options) if keys.any? { |key| options.has_key? key} end
Public Instance Methods
update_balance(params={})
click to toggle source
# File lib/coinone/account/balance.rb, line 27 def update_balance(params={}) @result = params[:result] if params.has_key? :result if params.has_key? :normalWallets @normal_wallets.clear params[:normalWallets].each do |wallet| @normal_wallets.push(NormalWallet.new(wallet)) end end @btc.update_wallet(params[:btc]) if params.has_key? :btc @eth.update_wallet(params[:eth]) if params.has_key? :eth @etc.update_wallet(params[:etc]) if params.has_key? :etc end