Class: Fugle::Trade Private

Inherits:
Object
  • Object
show all
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

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Since:

  • 0.1.0



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

#orderObject (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.

Since:

  • 0.1.0



11
12
13
# File 'lib/fugle/trade.rb', line 11

def order
  @order
end

#priceObject (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.

Since:

  • 0.1.0



11
12
13
# File 'lib/fugle/trade.rb', line 11

def price
  @price
end

#serialObject (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.

Since:

  • 0.1.0



11
12
13
# File 'lib/fugle/trade.rb', line 11

def serial
  @serial
end

#unitObject (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.

Since:

  • 0.1.0



11
12
13
# File 'lib/fugle/trade.rb', line 11

def unit
  @unit
end

#updated_atObject (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.

Since:

  • 0.1.0



11
12
13
# File 'lib/fugle/trade.rb', line 11

def updated_at
  @updated_at
end

#volumeObject (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.

Since:

  • 0.1.0



11
12
13
# File 'lib/fugle/trade.rb', line 11

def volume
  @volume
end

Instance Method Details

#to_hHash

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

Returns:

  • (Hash)

    the response as hash

Since:

  • 0.1.0



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

Returns:

  • (String)

    the json string

Since:

  • 0.1.0



47
48
49
# File 'lib/fugle/trade.rb', line 47

def to_json(*args)
  to_h.to_json(*args)
end