Class: DiscoApp::SessionStorage
- Inherits:
-
Object
- Object
- DiscoApp::SessionStorage
- Defined in:
- app/models/disco_app/session_storage.rb
Class Method Summary collapse
Class Method Details
.retrieve(id) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/disco_app/session_storage.rb', line 11 def self.retrieve(id) return unless id shop = Shop.find(id) ShopifyAPI::Session.new(domain: shop.shopify_domain, token: shop.shopify_token, api_version: shop.api_version) rescue ActiveRecord::RecordNotFound nil end |
.store(session, *args) ⇒ Object
4 5 6 7 8 9 |
# File 'app/models/disco_app/session_storage.rb', line 4 def self.store(session, *args) shop = Shop.find_or_initialize_by(shopify_domain: session.url) shop.shopify_token = session.token shop.save! shop.id end |