Class: Coinone::Account::Balance
- Inherits:
-
Object
- Object
- Coinone::Account::Balance
- Defined in:
- lib/coinone/account/balance.rb,
lib/coinone/account/balance/wallet.rb,
lib/coinone/account/balance/normal_wallet.rb
Defined Under Namespace
Classes: NormalWallet, Wallet
Instance Attribute Summary collapse
-
#btc ⇒ Object
readonly
Returns the value of attribute btc.
-
#etc ⇒ Object
readonly
Returns the value of attribute etc.
-
#eth ⇒ Object
readonly
Returns the value of attribute eth.
-
#normal_wallets ⇒ Object
readonly
Returns the value of attribute normal_wallets.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Balance
constructor
A new instance of Balance.
- #update_balance(params = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Balance
Returns a new instance of Balance.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/coinone/account/balance.rb', line 13 def initialize(={}) @result = [:result] || nil @normal_wallets = [] @btc = Wallet.new() @eth = Wallet.new() @etc = Wallet.new() keys = [:normalWallets, :btc, :eth, :eth] update_balance() if keys.any? { |key| .has_key? key} end |
Instance Attribute Details
#btc ⇒ Object (readonly)
Returns the value of attribute btc.
11 12 13 |
# File 'lib/coinone/account/balance.rb', line 11 def btc @btc end |
#etc ⇒ Object (readonly)
Returns the value of attribute etc.
11 12 13 |
# File 'lib/coinone/account/balance.rb', line 11 def etc @etc end |
#eth ⇒ Object (readonly)
Returns the value of attribute eth.
11 12 13 |
# File 'lib/coinone/account/balance.rb', line 11 def eth @eth end |
#normal_wallets ⇒ Object (readonly)
Returns the value of attribute normal_wallets.
11 12 13 |
# File 'lib/coinone/account/balance.rb', line 11 def normal_wallets @normal_wallets end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
10 11 12 |
# File 'lib/coinone/account/balance.rb', line 10 def result @result end |
Instance Method Details
#update_balance(params = {}) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# 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 |