Class: Vertpig::Summary

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/vertpig/summary.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#extract_timestamp

Constructor Details

#initialize(attrs = {}) ⇒ Summary

Returns a new instance of Summary.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vertpig/summary.rb', line 11

def initialize(attrs = {})
  @name             = attrs['MarketName']
  @high             = attrs['High']
  @low              = attrs['Low']
  @volume           = attrs['Volume']
  @last             = attrs['Last']
  @base_volume      = attrs['BaseVolume']
  @bid              = attrs['Bid']
  @ask              = attrs['Ask']
  @open_buy_orders  = attrs['OpenBuyOrders']
  @open_sell_orders = attrs['OpenSellOrders']
  @previous_day     = attrs['PrevDay']
  @updated_at       = extract_timestamp(attrs['TimeStamp'])
  @created_at       = extract_timestamp(attrs['Created'])
  @raw              = attrs
end

Instance Attribute Details

#askObject (readonly)

Returns the value of attribute ask.



6
7
8
# File 'lib/vertpig/summary.rb', line 6

def ask
  @ask
end

#base_volumeObject (readonly) Also known as: base_vol

Returns the value of attribute base_volume.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def base_volume
  @base_volume
end

#bidObject (readonly)

Returns the value of attribute bid.



6
7
8
# File 'lib/vertpig/summary.rb', line 6

def bid
  @bid
end

#created_atObject (readonly)

Returns the value of attribute created_at.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def created_at
  @created_at
end

#highObject (readonly)

Returns the value of attribute high.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def high
  @high
end

#lastObject (readonly)

Returns the value of attribute last.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def last
  @last
end

#lowObject (readonly)

Returns the value of attribute low.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def low
  @low
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def name
  @name
end

#open_buy_ordersObject (readonly)

Returns the value of attribute open_buy_orders.



6
7
8
# File 'lib/vertpig/summary.rb', line 6

def open_buy_orders
  @open_buy_orders
end

#open_sell_ordersObject (readonly)

Returns the value of attribute open_sell_orders.



6
7
8
# File 'lib/vertpig/summary.rb', line 6

def open_sell_orders
  @open_sell_orders
end

#previous_dayObject (readonly)

Returns the value of attribute previous_day.



6
7
8
# File 'lib/vertpig/summary.rb', line 6

def previous_day
  @previous_day
end

#rawObject (readonly)

Returns the value of attribute raw.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def raw
  @raw
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



6
7
8
# File 'lib/vertpig/summary.rb', line 6

def updated_at
  @updated_at
end

#volumeObject (readonly) Also known as: vol

Returns the value of attribute volume.



5
6
7
# File 'lib/vertpig/summary.rb', line 5

def volume
  @volume
end

Class Method Details

.allObject



28
29
30
# File 'lib/vertpig/summary.rb', line 28

def self.all
  client.get('public/getmarketsummaries').map{|data| new(data) }
end