Class: Coinone::Account::DailyBalance::Balance
- Inherits:
-
Object
- Object
- Coinone::Account::DailyBalance::Balance
- Defined in:
- lib/coinone/account/daily_balance/balance.rb
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.
-
#krw ⇒ Object
readonly
Returns the value of attribute krw.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
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.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 11 def initialize(={}) @timestamp = nil @value = 0 @btc = 0 @eth = 0 @etc = 0 @krw = 0 update_balance() end |
Instance Attribute Details
#btc ⇒ Object (readonly)
Returns the value of attribute btc.
9 10 11 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 9 def btc @btc end |
#etc ⇒ Object (readonly)
Returns the value of attribute etc.
9 10 11 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 9 def etc @etc end |
#eth ⇒ Object (readonly)
Returns the value of attribute eth.
9 10 11 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 9 def eth @eth end |
#krw ⇒ Object (readonly)
Returns the value of attribute krw.
9 10 11 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 9 def krw @krw end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
9 10 11 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 9 def @timestamp end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 9 def value @value end |
Instance Method Details
#update_balance(params = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/coinone/account/daily_balance/balance.rb', line 23 def update_balance(params={}) @timestamp= params[:timestamp].to_i if params.has_key? :timestamp @value = params[:value].to_d if params.has_key? :value @btc = params[:btc].to_d if params.has_key? :btc @eth = params[:eth].to_d if params.has_key? :eth @etc = params[:etc].to_d if params.has_key? :etc @krw = params[:krw].to_d if params.has_key? :krw end |