Class: Coinone::Account::DailyBalance

Inherits:
Object
  • Object
show all
Defined in:
lib/coinone/account/daily_balance.rb,
lib/coinone/account/daily_balance/balance.rb

Defined Under Namespace

Classes: Balance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DailyBalance

Returns a new instance of DailyBalance.



12
13
14
15
16
17
18
19
20
# File 'lib/coinone/account/daily_balance.rb', line 12

def initialize(options={})

  @result = options[:result] || nil
  @daily_balances = []

  update_balance(options) if options.has_key? :dailyBalance


end

Instance Attribute Details

#daily_balancesObject (readonly)

Returns the value of attribute daily_balances.



10
11
12
# File 'lib/coinone/account/daily_balance.rb', line 10

def daily_balances
  @daily_balances
end

#resultObject (readonly)

Returns the value of attribute result.



9
10
11
# File 'lib/coinone/account/daily_balance.rb', line 9

def result
  @result
end

Instance Method Details

#update_balance(params = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/coinone/account/daily_balance.rb', line 22

def update_balance(params={})

  @result = params[:result] if params.has_key? :result
  if params.has_key? :dailyBalance
    @daily_balances.clear
    params[:dailyBalance].each do |balance|
      @daily_balances.push(Balance.new(balance))
    end
  end
end