Class: Coinone::Public::Tickers
- Inherits:
-
Object
- Object
- Coinone::Public::Tickers
- Defined in:
- lib/coinone/public/tickers.rb,
lib/coinone/public/tickers/ticker.rb
Defined Under Namespace
Classes: Ticker
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#tickers ⇒ Object
readonly
Returns the value of attribute tickers.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Tickers
constructor
A new instance of Tickers.
- #push_tickers(params) ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Tickers
Returns a new instance of Tickers.
9 10 11 12 13 14 |
# File 'lib/coinone/public/tickers.rb', line 9 def initialize(params={}) @result = params[:result] || nil @timestamp = params[:timestamp] || nil @tickers = [] push_tickers(params) end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
6 7 8 |
# File 'lib/coinone/public/tickers.rb', line 6 def result @result end |
#tickers ⇒ Object (readonly)
Returns the value of attribute tickers.
7 8 9 |
# File 'lib/coinone/public/tickers.rb', line 7 def tickers @tickers end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
7 8 9 |
# File 'lib/coinone/public/tickers.rb', line 7 def @timestamp end |
Instance Method Details
#push_tickers(params) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/coinone/public/tickers.rb', line 16 def push_tickers(params) @tickers.clear 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 |