Class: CoinSync::Importers::Changelly::HistoryEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/coinsync/importers/changelly.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ HistoryEntry

Returns a new instance of HistoryEntry.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/coinsync/importers/changelly.rb', line 17

def initialize(line)
  @status = line[0]
  @date = Time.parse(line[1] + ' +0000')

  amount, name = line[2].gsub(',', '').split(/\s+/)
  @exchanged_currency = CryptoCurrency.new(name)
  @exchanged_amount = BigDecimal.new(amount)

  amount, name = line[6].gsub(',', '').split(/\s+/)
  @received_currency = CryptoCurrency.new(name)
  @received_amount = BigDecimal.new(amount)
end

Instance Attribute Details

#dateObject

Returns the value of attribute date.



15
16
17
# File 'lib/coinsync/importers/changelly.rb', line 15

def date
  @date
end

#exchanged_amountObject

Returns the value of attribute exchanged_amount.



15
16
17
# File 'lib/coinsync/importers/changelly.rb', line 15

def exchanged_amount
  @exchanged_amount
end

#exchanged_currencyObject

Returns the value of attribute exchanged_currency.



15
16
17
# File 'lib/coinsync/importers/changelly.rb', line 15

def exchanged_currency
  @exchanged_currency
end

#received_amountObject

Returns the value of attribute received_amount.



15
16
17
# File 'lib/coinsync/importers/changelly.rb', line 15

def received_amount
  @received_amount
end

#received_currencyObject

Returns the value of attribute received_currency.



15
16
17
# File 'lib/coinsync/importers/changelly.rb', line 15

def received_currency
  @received_currency
end

#statusObject

Returns the value of attribute status.



15
16
17
# File 'lib/coinsync/importers/changelly.rb', line 15

def status
  @status
end