class Bitstamper::Models::UserTransaction

Constants

MAPPING
TYPES

Attributes

bch[RW]
btc[RW]
btc_eur[RW]
btc_usd[RW]
datetime[RW]
eth[RW]
eth_btc[RW]
eth_eur[RW]
eth_usd[RW]
eur[RW]
fee[RW]
id[RW]
ltc[RW]
order_id[RW]
transaction_type[RW]
type[RW]
usd[RW]
xrp[RW]

Public Class Methods

new(hash) click to toggle source
# File lib/bitstamper/models/user_transaction.rb, line 37
def initialize(hash)
  hash.each do |key, value|
    type            =     ::Bitstamper::Models::UserTransaction::MAPPING.fetch(key, nil)
    value           =     value && type ? ::Bitstamper::Utilities::convert_value(value, type) : value
    self.send("#{key}=", value) if self.respond_to?(key)
  end
  
  self.id           =     hash.fetch("id", hash.fetch("tid", nil))&.to_s
  
  self.transaction_type = TYPES[self.type]
end
parse(data) click to toggle source
# File lib/bitstamper/models/user_transaction.rb, line 49
def self.parse(data)
  data&.collect { |item| ::Bitstamper::Models::UserTransaction.new(item) }
end