Class: Moneymarket::AccountProvider
- Inherits:
-
Object
- Object
- Moneymarket::AccountProvider
- Defined in:
- lib/moneymarket/core/account_provider.rb
Instance Method Summary collapse
- #account_for(_user_id, _currency) ⇒ Object
- #exchange_account_for(_currency) ⇒ Object
-
#initialize ⇒ AccountProvider
constructor
A new instance of AccountProvider.
- #preload_balances(_order) ⇒ Object
- #preload_user_balances(_users, _currencies) ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ AccountProvider
Returns a new instance of AccountProvider.
3 4 5 |
# File 'lib/moneymarket/core/account_provider.rb', line 3 def initialize @accounts = {} end |
Instance Method Details
#account_for(_user_id, _currency) ⇒ Object
15 16 17 |
# File 'lib/moneymarket/core/account_provider.rb', line 15 def account_for(_user_id, _currency) assert_implemented :account_for end |
#exchange_account_for(_currency) ⇒ Object
11 12 13 |
# File 'lib/moneymarket/core/account_provider.rb', line 11 def exchange_account_for(_currency) assert_implemented :exchange_account_for end |
#preload_balances(_order) ⇒ Object
23 24 25 26 |
# File 'lib/moneymarket/core/account_provider.rb', line 23 def preload_balances(_order) _order.base_balance = fetch_balance(_order.account_id, _order.base_currency) _order.quote_balance = fetch_balance(_order.account_id, _order.quote_currency) end |
#preload_user_balances(_users, _currencies) ⇒ Object
19 20 21 |
# File 'lib/moneymarket/core/account_provider.rb', line 19 def preload_user_balances(_users, _currencies) assert_implemented :preload_user_balances end |
#reset ⇒ Object
7 8 9 |
# File 'lib/moneymarket/core/account_provider.rb', line 7 def reset @accounts = {} end |