class Moneymarket::AccountProvider

Public Class Methods

new() click to toggle source
# File lib/moneymarket/core/account_provider.rb, line 3
def initialize
  @accounts = {}
end

Public Instance Methods

account_for(_user_id, _currency) click to toggle source
# File lib/moneymarket/core/account_provider.rb, line 15
def account_for(_user_id, _currency)
  assert_implemented :account_for
end
exchange_account_for(_currency) click to toggle source
# File lib/moneymarket/core/account_provider.rb, line 11
def exchange_account_for(_currency)
  assert_implemented :exchange_account_for
end
preload_balances(_order) click to toggle source
# 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) click to toggle source
# File lib/moneymarket/core/account_provider.rb, line 19
def preload_user_balances(_users, _currencies)
  assert_implemented :preload_user_balances
end
reset() click to toggle source
# File lib/moneymarket/core/account_provider.rb, line 7
def reset
  @accounts = {}
end

Private Instance Methods

assert_implemented(_name) click to toggle source
# File lib/moneymarket/core/account_provider.rb, line 30
def assert_implemented(_name)
  raise NotImplementedError, "#{_name} is not implemented"
end