module Integrations module Betfair class AccountManager < Base def refresh_account_balance # go check the account balance and update the ExchangeAccount for this account res = self.class.post("#{API_ACCOUNT_ENDPOINT}/getAccountFunds/", { headers: @connection.api_headers, data: {} }) if res['availableToBetBalance'] acc_bal = res['availableToBetBalance'] @account.update(account_balance: acc_bal, account_balance_last_checked: Time.now) end @account.account_balance end end end end