Class: ShopifyApp::SessionStorage::ShopStorageStrategy
- Inherits:
-
Object
- Object
- ShopifyApp::SessionStorage::ShopStorageStrategy
- Defined in:
- lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb
Class Method Summary collapse
Class Method Details
.retrieve(id) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb', line 12 def self.retrieve(id) return unless id if shop = Shop.find_by(id: id) ShopifyAPI::Session.new( domain: shop.shopify_domain, token: shop.shopify_token, api_version: shop.api_version ) end end |
.store(auth_session, *args) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/shopify_app/session/storage_strategies/shop_storage_strategy.rb', line 5 def self.store(auth_session, *args) shop = Shop.find_or_initialize_by(shopify_domain: auth_session.domain) shop.shopify_token = auth_session.token shop.save! shop.id end |