Class: Remitmd::Transaction

Inherits:
Model
  • Object
show all
Defined in:
lib/remitmd/models.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#inspect, #to_h

Constructor Details

#initialize(attrs) ⇒ Transaction

Returns a new instance of Transaction.



135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/remitmd/models.rb', line 135

def initialize(attrs)
  h = attrs.transform_keys(&:to_s)
  @id           = h["id"]
  @tx_hash      = h["tx_hash"]
  @from         = h["from"]
  @to           = h["to"]
  @amount       = decimal(h["amount"])
  @fee          = decimal(h["fee"] || "0")
  @memo         = h["memo"] || ""
  @chain_id     = h["chain_id"]&.to_i
  @block_number = h["block_number"].to_i
  @created_at   = parse_time(h["created_at"])
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def amount
  @amount
end

#block_numberObject (readonly)

Returns the value of attribute block_number.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def block_number
  @block_number
end

#chain_idObject (readonly)

Returns the value of attribute chain_id.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def chain_id
  @chain_id
end

#created_atObject (readonly)

Returns the value of attribute created_at.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def created_at
  @created_at
end

#feeObject (readonly)

Returns the value of attribute fee.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def fee
  @fee
end

#fromObject (readonly)

Returns the value of attribute from.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def from
  @from
end

#idObject (readonly)

Returns the value of attribute id.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def id
  @id
end

#memoObject (readonly)

Returns the value of attribute memo.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def memo
  @memo
end

#toObject (readonly)

Returns the value of attribute to.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def to
  @to
end

#tx_hashObject (readonly)

Returns the value of attribute tx_hash.



149
150
151
# File 'lib/remitmd/models.rb', line 149

def tx_hash
  @tx_hash
end