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
10 11 12 13 14 15 16 |
# File 'app/models/disco_app/session_storage.rb', line 10 def self.retrieve(id) return unless id shop = Shop.find(id) ShopifyAPI::Session.new(shop.shopify_domain, shop.shopify_token) rescue ActiveRecord::RecordNotFound nil end |
.store(session) ⇒ Object
3 4 5 6 7 8 |
# File 'app/models/disco_app/session_storage.rb', line 3 def self.store(session) shop = Shop.find_or_initialize_by(shopify_domain: session.url) shop.shopify_token = session.token shop.save! shop.id end |