Sha256: bc7af58f3a48307b8f089c7cd6bd187eeeacf818922f7495cd34d7514b88a9b4
Contents?: true
Size: 1.41 KB
Versions: 47
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module ShopifyApp class SessionRepository class ConfigurationError < StandardError; end class << self attr_writer :shop_storage attr_writer :user_storage def retrieve_shop_session(id) shop_storage.retrieve(id) end def retrieve_user_session(id) user_storage.retrieve(id) end def retrieve_shop_session_by_shopify_domain(shopify_domain) shop_storage.retrieve_by_shopify_domain(shopify_domain) end def retrieve_user_session_by_shopify_user_id(user_id) user_storage.retrieve_by_shopify_user_id(user_id) end def store_shop_session(session) shop_storage.store(session) end def store_user_session(session, user) user_storage.store(session, user) end def shop_storage load_shop_storage || raise(ConfigurationError, "ShopifySessionRepository.shop_storage is not configured!") end def user_storage load_user_storage end private def load_shop_storage return unless @shop_storage @shop_storage.respond_to?(:safe_constantize) ? @shop_storage.safe_constantize : @shop_storage end def load_user_storage return NullUserSessionStore unless @user_storage @user_storage.respond_to?(:safe_constantize) ? @user_storage.safe_constantize : @user_storage end end end end
Version data entries
47 entries across 47 versions & 2 rubygems