Class: Coinone::Public::Tickers

Inherits:
Object
  • Object
show all
Defined in:
lib/coinone/public/tickers.rb,
lib/coinone/public/tickers/ticker.rb

Defined Under Namespace

Classes: Ticker

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Tickers

Returns a new instance of Tickers.



8
9
10
11
# File 'lib/coinone/public/tickers.rb', line 8

def initialize(params={})
  @tickers = []
  push_tickers(params)
end

Instance Attribute Details

#tickersObject (readonly)

Returns the value of attribute tickers.



6
7
8
# File 'lib/coinone/public/tickers.rb', line 6

def tickers
  @tickers
end

Instance Method Details

#push_tickers(params) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/coinone/public/tickers.rb', line 13

def push_tickers(params)
  currency_list = [:btc, :eth, :etc]
  currency_list.each do |currency|
    if params.has_key? currency
      @tickers.push(Ticker.new(params[currency]))
    end
  end
  @tickers.push(Ticker.new(params)) if params.has_key? :currency
end