2025-05-15 10:19:56 -04:00
|
|
|
class PlaidItem::Syncer
|
|
|
|
attr_reader :plaid_item
|
|
|
|
|
|
|
|
def initialize(plaid_item)
|
|
|
|
@plaid_item = plaid_item
|
|
|
|
end
|
|
|
|
|
|
|
|
def perform_sync(sync)
|
2025-05-23 18:58:22 -04:00
|
|
|
# Loads item metadata, accounts, transactions, and other data to our DB
|
|
|
|
plaid_item.import_latest_plaid_data
|
|
|
|
|
|
|
|
# Processes the raw Plaid data and updates internal domain objects
|
|
|
|
plaid_item.process_accounts
|
|
|
|
|
|
|
|
# All data is synced, so we can now run an account sync to calculate historical balances and more
|
2025-05-26 05:39:14 -04:00
|
|
|
plaid_item.schedule_account_syncs(parent_sync: sync)
|
2025-05-15 10:19:56 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def perform_post_sync
|
2025-05-23 18:58:22 -04:00
|
|
|
# no-op
|
2025-05-15 10:19:56 -04:00
|
|
|
end
|
|
|
|
end
|