Class: AqBanking::Parsed::Transaction

Inherits:
Object
  • Object
show all
Extended by:
DefineField
Defined in:
lib/aq_banking/parsed/transaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DefineField

define_field

Constructor Details

#initialize(transaction_block) ⇒ Transaction

Returns a new instance of Transaction.



16
17
18
# File 'lib/aq_banking/parsed/transaction.rb', line 16

def initialize(transaction_block)
  @tree = transaction_block
end

Instance Attribute Details

#treeObject (readonly)

Returns the value of attribute tree.



7
8
9
# File 'lib/aq_banking/parsed/transaction.rb', line 7

def tree
  @tree
end

Instance Method Details

#to_hObject



24
25
26
27
28
29
30
# File 'lib/aq_banking/parsed/transaction.rb', line 24

def to_h
  %i(uid purpose local_bank_code local_account_number local_name remote_bank_code remote_account_number remote_name
    currency amount date valuta_date).reduce({}) do |result, field|
    result[field] = send(field)
    result
  end
end

#uidObject



20
21
22
# File 'lib/aq_banking/parsed/transaction.rb', line 20

def uid
  Digest::SHA256.hexdigest self.tree.text_value
end