SwiftBeanCountCompassCardMapper
public struct SwiftBeanCountCompassCardMapper
Mapper to map downloaded accounts and transactions to BeanCoutModel objects
-
AccountName for the other leg of a transaction
Declaration
Swift
public let defaultExpenseAccountName: AccountName -
AccountName for the other leg of a load transaction
Declaration
Swift
public let defaultAssetAccountName: AccountName -
Creates a mapper
Declaration
Swift
public init(ledger: Ledger)Parameters
ledgerLedger which will be used to look up things like account names
-
Creates a balance assertions from the downloaded string
Declaration
Swift
public func createBalance(cardNumber: String, balance: String, date inputDate: Date? = nil) throws -> BalanceParameters
cardNumberString with the compass card number
balanceString with the balance
dateDate to balance assertion should use, if nil defaults to tomorrow
Return Value
Array of Balances
-
Creates Transactions from the downloaded CSV String
Note: This method filters out transactions already existing in the ledger
Declaration
Swift
public func createTransactions(cardNumber: String, transactions: String) throws -> [Transaction]Parameters
cardNumberString with the compass card number
transactionsString of the transaction CSV
Return Value
Array of transactions
-
Creates Transactions from a provided CSVReader
Note: This method filters out transactions already existing in the ledger
Declaration
Swift
public func createTransactions(account: AccountName, reader: CSVReader) throws -> [Transaction]Parameters
accountAccountName of asset account in the ledger
readerCSVReader with the transaction CSV
Return Value
Array of transactions
-
Gets the correct account for the Compass Card from the ledger based on the card number
Declaration
Swift
public func ledgerCardAccountName(cardNumber: String) throws -> AccountNameParameters
cardNumberCompass Card Number
Return Value
AccountName from the ledger
View on GitHub
Install in Dash