SwiftBeanCountTangerineMapper

public struct SwiftBeanCountTangerineMapper

Mapper to map downloaded accounts and transactions to BeanCoutModel objects

  • AccountName for the other leg of the transaction

    Declaration

    Swift

    public let defaultAccountName: AccountName
  • Creates a mapper

    Declaration

    Swift

    public init(ledger: Ledger)

    Parameters

    ledger

    Ledger which will be used to look up things like account names

  • Creates balance assertions from the downloaded account JSON

    Declaration

    Swift

    public func createBalances(accounts: [[String : Any]], date: Date = Date()) throws -> [Balance]

    Parameters

    accounts

    JSONs downloaded from the Tangerine API

    date

    Date to balance assertion should use, defaults to the current date

    Return Value

    Array of Balances

  • Creates Transactions from JSON objects downloaded from the API

    Note: This method filters out transactions already existing in the ledger, so the count of the input and output arrays might be different

    Declaration

    Swift

    public func createTransactions(_ rawTransactions: [String : [[String : Any]]]) throws -> [Transaction]

    Parameters

    rawTransactions

    Array of JSON objects

    Return Value

    Array of transactions

  • Gets the correct account from the ledger based on the downloaded account JSON

    Declaration

    Swift

    public func ledgerAccountName(account: [String : Any]) throws -> AccountName

    Parameters

    account

    JSON from the API

    Return Value

    AccountName from the ledger