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.0.4 lib/shopify_app/session_storage.rb
shopify_app-7.0.2 lib/shopify_app/session_storage.rb
shopify_app-7.0.1 lib/shopify_app/session_storage.rb
shopify_app-7.0.0 lib/shopify_app/session_storage.rb
shopify_app-6.4.2 lib/shopify_app/session_storage.rb
shopify_app-6.4.1 lib/shopify_app/session_storage.rb
shopify_app-6.4.0 lib/shopify_app/session_storage.rb
shopify_app-6.3.0 lib/shopify_app/session_storage.rb