Module: DuodealerApp::SessionStorage::AccountStorageStrategy
- Defined in:
- lib/duodealer_app/session/storage_strategies/account_storage_strategy.rb
Instance Method Summary collapse
Instance Method Details
#retrieve(id) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/duodealer_app/session/storage_strategies/account_storage_strategy.rb', line 13 def retrieve(id) return unless id if account = self.find_by(id: id) DuodealerAPI::Session.new( domain: account.duodealer_domain, token: account.duodealer_token, api_version: account.api_version ) end end |
#store(auth_session, *args) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/duodealer_app/session/storage_strategies/account_storage_strategy.rb', line 6 def store(auth_session, *args) account = find_or_initialize_by(duodealer_domain: auth_session.domain) account.duodealer_token = auth_session.token account.save! account.id end |