Sha256: 29e622e563082453e090f979f7d06741ea0838ca498a0d237723a13f2252c507

Contents?: true

Size: 487 Bytes

Versions: 28

Compression:

Stored size: 487 Bytes

Contents

module ShopifyApp
  module SessionStorage
    extend ActiveSupport::Concern

    class_methods do
      def store(session)
        shop = self.find_or_initialize_by(shopify_domain: session.url)
        shop.shopify_token = session.token
        shop.save!
        shop.id
      end

      def retrieve(id)
        return unless id

        if shop = self.find_by(id: id)
          ShopifyAPI::Session.new(shop.shopify_domain, shop.shopify_token)
        end
      end
    end

  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
shopify_app-7.4.0 lib/shopify_app/session_storage.rb
shopify_app-7.3.0 lib/shopify_app/session_storage.rb
shopify_app-7.2.11 lib/shopify_app/session_storage.rb
shopify_app-7.2.10 lib/shopify_app/session_storage.rb
shopify_app-7.2.9 lib/shopify_app/session_storage.rb
shopify_app-7.2.8 lib/shopify_app/session_storage.rb
shopify_app-7.2.7 lib/shopify_app/session_storage.rb
shopify_app-7.2.6 lib/shopify_app/session_storage.rb
shopify_app-7.2.5 lib/shopify_app/session_storage.rb
shopify_app-7.2.3 lib/shopify_app/session_storage.rb
shopify_app-7.2.0 lib/shopify_app/session_storage.rb
shopify_app-7.1.1 lib/shopify_app/session_storage.rb
shopify_app-7.1.0 lib/shopify_app/session_storage.rb
shopify_app-7.0.11 lib/shopify_app/session_storage.rb
shopify_app-7.0.10 lib/shopify_app/session_storage.rb
shopify_app-7.0.9 lib/shopify_app/session_storage.rb
shopify_app-7.0.8 lib/shopify_app/session_storage.rb
shopify_app-7.0.7 lib/shopify_app/session_storage.rb
shopify_app-7.0.6 lib/shopify_app/session_storage.rb
shopify_app-7.0.5 lib/shopify_app/session_storage.rb