mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 06:44:52 +00:00
* **Add Coinbase integration with item and account management** - Creates migrations for `coinbase_items` and `coinbase_accounts`. - Adds models, controllers, views, and background tasks to support account linking, syncing, and transaction handling. - Implements Coinbase API client and adapter for seamless integration. - Supports ActiveRecord encryption for secure credential storage. - Adds UI components for provider setup, account management, and synchronization. * Localize Coinbase-related UI strings, refine account linking for security, and add timeouts to Coinbase API requests. * Localize Coinbase account handling to support native currencies (USD, EUR, GBP, etc.) across balances, trades, holdings, and transactions. * Improve Coinbase processing with timezone-safe parsing, native currency support, and immediate holdings updates. * Improve trend percentage formatting and enhance race condition handling for Coinbase account linking. * Fix log message wording for orphan cleanup * Ensure `selected_accounts` parameter is sanitized by rejecting blank entries. * Add tests for Coinbase integration: account, item, and controller coverage - Adds unit tests for `CoinbaseAccount` and `CoinbaseItem` models. - Adds integration tests for `CoinbaseItemsController`. - Introduces Stimulus `select-all` controller for UI checkbox handling. - Localizes UI strings and logging for Coinbase integration. * Update test fixtures to use consistent placeholder API keys and secrets * Refine `coinbase_item` tests to ensure deterministic ordering and improve scope assertions. * Integrate `SyncStats::Collector` into Coinbase syncer to streamline statistics collection and enhance consistency. * Localize Coinbase sync status messages and improve sync summary test coverage. * Update `CoinbaseItem` encryption: use deterministic encryption for `api_key` and standard for `api_secret`. * fix schema drift * Beta labels to lower expectations --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
30 lines
911 B
Ruby
30 lines
911 B
Ruby
# Broadcasts Turbo Stream updates when a Coinbase sync completes.
|
|
# Updates account views and notifies the family of sync completion.
|
|
class CoinbaseItem::SyncCompleteEvent
|
|
attr_reader :coinbase_item
|
|
|
|
# @param coinbase_item [CoinbaseItem] The item that completed syncing
|
|
def initialize(coinbase_item)
|
|
@coinbase_item = coinbase_item
|
|
end
|
|
|
|
# Broadcasts sync completion to update UI components.
|
|
def broadcast
|
|
# Update UI with latest account data
|
|
coinbase_item.accounts.each do |account|
|
|
account.broadcast_sync_complete
|
|
end
|
|
|
|
# Update the Coinbase item view
|
|
coinbase_item.broadcast_replace_to(
|
|
coinbase_item.family,
|
|
target: "coinbase_item_#{coinbase_item.id}",
|
|
partial: "coinbase_items/coinbase_item",
|
|
locals: { coinbase_item: coinbase_item }
|
|
)
|
|
|
|
# Let family handle sync notifications
|
|
coinbase_item.family.broadcast_sync_complete
|
|
end
|
|
end
|