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