Class: KoinimPrice::Ticker

Inherits:
Object
  • Object
show all
Defined in:
lib/koinim_price/ticker.rb

Constant Summary collapse

API_URL =
"#{KOINIM_URL}ticker"

Class Method Summary collapse

Class Method Details

.average_priceObject



22
23
24
# File 'lib/koinim_price/ticker.rb', line 22

def self.average_price
  response['avg']
end

.buy_priceObject



10
11
12
# File 'lib/koinim_price/ticker.rb', line 10

def self.buy_price
  response['buy']
end

.highestObject



30
31
32
# File 'lib/koinim_price/ticker.rb', line 30

def self.highest
  response['high']
end

.lowestObject



34
35
36
# File 'lib/koinim_price/ticker.rb', line 34

def self.lowest
  response['low']
end

.refreshObject



38
39
40
41
42
# File 'lib/koinim_price/ticker.rb', line 38

def self.refresh
  @response = nil
  response
  true
end

.responseObject



44
45
46
# File 'lib/koinim_price/ticker.rb', line 44

def self.response
  @response ||= JSON.parse(HTTParty.get(API_URL).body)
end

.sell_priceObject



14
15
16
# File 'lib/koinim_price/ticker.rb', line 14

def self.sell_price
  response['sell']
end

.volumeObject



18
19
20
# File 'lib/koinim_price/ticker.rb', line 18

def self.volume
  response['volume']
end

.weighted_average_priceObject



26
27
28
# File 'lib/koinim_price/ticker.rb', line 26

def self.weighted_average_price
  response['wavg']
end