Module: LogCabin::Modules::Plaid

Defined in:
lib/burglar/modules/plaid.rb

Overview

Plaid

Constant Summary collapse

PLAID_DOMAIN =
'https://plaid.com'.freeze

Instance Method Summary collapse

Instance Method Details

#raw_transactionsObject

rubocop:disable Metrics/MethodLength



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/burglar/modules/plaid.rb', line 13

def raw_transactions # rubocop:disable Metrics/MethodLength
  @raw_transactions ||= all_transactions.map do |row|
    amount = format('$%.2f', row.amount)
    name = row.name.downcase
    action = guess_action(name)
    state = row.pending ? :pending : :cleared

    ::Ledger::Entry.new(
      name: name,
      state: state,
      date: row.date,
      actions: [
        { name: action, amount: amount },
        { name:  }
      ],
      tags: { 'transaction_id' => row.transaction_id }
    )
  end
end