Class: KoinimPrice::Ticker
- Inherits:
-
Object
- Object
- KoinimPrice::Ticker
- Defined in:
- lib/koinim_price/ticker.rb
Constant Summary collapse
- API_URL =
"#{KOINIM_URL}ticker"
Class Method Summary collapse
- .average_price ⇒ Object
- .buy_price ⇒ Object
- .highest ⇒ Object
- .lowest ⇒ Object
- .refresh ⇒ Object
- .response ⇒ Object
- .sell_price ⇒ Object
- .volume ⇒ Object
- .weighted_average_price ⇒ Object
Class Method Details
.average_price ⇒ Object
22 23 24 |
# File 'lib/koinim_price/ticker.rb', line 22 def self.average_price response['avg'] end |
.buy_price ⇒ Object
10 11 12 |
# File 'lib/koinim_price/ticker.rb', line 10 def self.buy_price response['buy'] end |
.highest ⇒ Object
30 31 32 |
# File 'lib/koinim_price/ticker.rb', line 30 def self.highest response['high'] end |
.lowest ⇒ Object
34 35 36 |
# File 'lib/koinim_price/ticker.rb', line 34 def self.lowest response['low'] end |
.refresh ⇒ Object
38 39 40 41 42 |
# File 'lib/koinim_price/ticker.rb', line 38 def self.refresh @response = nil response true end |
.response ⇒ Object
44 45 46 |
# File 'lib/koinim_price/ticker.rb', line 44 def self.response @response ||= JSON.parse(HTTParty.get(API_URL).body) end |
.sell_price ⇒ Object
14 15 16 |
# File 'lib/koinim_price/ticker.rb', line 14 def self.sell_price response['sell'] end |
.volume ⇒ Object
18 19 20 |
# File 'lib/koinim_price/ticker.rb', line 18 def self.volume response['volume'] end |
.weighted_average_price ⇒ Object
26 27 28 |
# File 'lib/koinim_price/ticker.rb', line 26 def self.weighted_average_price response['wavg'] end |