CompassCardDownloader
@available(iOS 14.5, macOS 11.3, *)
public class CompassCardDownloader
Class to download the current balance and transactions from your CompassCard
This class uses a webscraper to login. Your delegate needs to provide a view to add the webview to
-
Delegate for the CompassCardDownloader
Declaration
Swift
public weak var delegate: CompassCardDownloaderDelegate? -
Creates an instance of the CompassCardDownloader
Declaration
Swift
public init() -
Logs into the Compass Card website and reads the current balance
Note: If you want to call this function multiple times, be aware that it will request a view every time
Declaration
Swift
public func authorizeAndGetBalance(email: String, password: String, _ completion: @escaping (Result<(String, String), Error>) -> Void)Parameters
emailemail adress to login
passwordpassword to login
completioncompletion handler - receives result of card number and balance
-
Downloads the transactions for the card
Note: you need to call this function after
authorizeAndGetBalanceas only this one adds the webview to the view from the delegateDeclaration
Swift
public func downloadCardTransactions(cardNumber: String, dateToLoadFrom: Date, _ completion: @escaping (Result<String, Error>) -> Void)Parameters
dateToLoadFromDate which will be passed to the API as start date to load transactions
completioncompletion handler which returns a string with the CSV result
View on GitHub
Install in Dash
CompassCardDownloader Class Reference