class CoinSync::Importers::BitBayAPI::HistoryEntry
Attributes
amount[RW]
currency[RW]
date[RW]
type[RW]
Public Class Methods
new(hash)
click to toggle source
# File lib/coinsync/importers/bitbay_api.rb, line 34 def initialize(hash) @date = POLISH_TIMEZONE.local_to_utc(Time.parse(hash['time'])) @amount = BigDecimal.new(hash['amount']) @type = hash['operation_type'] @currency = parse_currency(hash['currency']) end
Public Instance Methods
crypto?()
click to toggle source
# File lib/coinsync/importers/bitbay_api.rb, line 41 def crypto? @currency.crypto? end
fiat?()
click to toggle source
# File lib/coinsync/importers/bitbay_api.rb, line 45 def fiat? @currency.fiat? end
parse_currency(code)
click to toggle source
# File lib/coinsync/importers/bitbay_api.rb, line 49 def parse_currency(code) case code.upcase when 'BCC' then CryptoCurrency.new('BCH') when 'BTC' then CryptoCurrency.new('BTC') when 'BTG' then CryptoCurrency.new('BTG') when 'DASH' then CryptoCurrency.new('DASH') when 'ETH' then CryptoCurrency.new('ETH') when 'GAME' then CryptoCurrency.new('GAME') when 'KZC' then CryptoCurrency.new('KZC') when 'LSK' then CryptoCurrency.new('LSK') when 'LTC' then CryptoCurrency.new('LTC') when 'XIN' then CryptoCurrency.new('XIN') when 'XRP' then CryptoCurrency.new('XRP') when 'EUR' then FiatCurrency.new('EUR') when 'USD' then FiatCurrency.new('USD') when 'PLN' then FiatCurrency.new('PLN') else raise "Unknown currency: #{code}" end end