Class: Fugle::Trade Private
- Inherits:
-
Object
- Object
- Fugle::Trade
- Defined in:
- lib/fugle/trade.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The trade information
Instance Attribute Summary collapse
- #order ⇒ Object readonly private
- #price ⇒ Object readonly private
- #serial ⇒ Object readonly private
- #unit ⇒ Object readonly private
- #updated_at ⇒ Object readonly private
- #volume ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(item) ⇒ Trade
constructor
private
A new instance of Trade.
-
#to_h ⇒ Hash
private
Convert to Hash.
-
#to_json(*args) ⇒ String
private
Convert to JSON.
Constructor Details
#initialize(item) ⇒ Trade
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Trade.
15 16 17 18 19 20 21 22 |
# File 'lib/fugle/trade.rb', line 15 def initialize(item) @price = item['price'] @unit = item['unit'] @order = item['order'] @volume = item['volume'] @serial = item['serial'] @updated_at = DateTime.parse(item['at']) if item['at'] end |
Instance Attribute Details
#order ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/trade.rb', line 11 def order @order end |
#price ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/trade.rb', line 11 def price @price end |
#serial ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/trade.rb', line 11 def serial @serial end |
#unit ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/trade.rb', line 11 def unit @unit end |
#updated_at ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/trade.rb', line 11 def updated_at @updated_at end |
#volume ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/trade.rb', line 11 def volume @volume end |
Instance Method Details
#to_h ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert to Hash
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fugle/trade.rb', line 30 def to_h { price: @price, unit: @uint, volume: @volume, order: @order, serial: @serial, updated_at: @updated_at } end |
#to_json(*args) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert to JSON
47 48 49 |
# File 'lib/fugle/trade.rb', line 47 def to_json(*args) to_h.to_json(*args) end |