Sha256: ec0ccb6ca53111c0eac5999533ee59d103f8defa2d2eca97ef9b37e8924c2691

Contents?: true

Size: 432 Bytes

Versions: 69

Compression:

Stored size: 432 Bytes

Contents

module DiscoApp
  class SessionStorage
    def self.store(session)
      shop = Shop.find_or_initialize_by(shopify_domain: session.url)
      shop.shopify_token = session.token
      shop.save!
      shop.id
    end

    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
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release app/models/disco_app/session_storage.rb
disco_app-0.6.0 app/models/disco_app/session_storage.rb
disco_app-0.6.1 app/models/disco_app/session_storage.rb
disco_app-0.6.2 app/models/disco_app/session_storage.rb
disco_app-0.6.3 app/models/disco_app/session_storage.rb
disco_app-0.6.4 app/models/disco_app/session_storage.rb
disco_app-0.6.5 app/models/disco_app/session_storage.rb
disco_app-0.6.6 app/models/disco_app/session_storage.rb
disco_app-0.6.7 app/models/disco_app/session_storage.rb
disco_app-0.6.8 app/models/disco_app/session_storage.rb
disco_app-0.6.9 app/models/disco_app/session_storage.rb
disco_app-0.7.0 app/models/disco_app/session_storage.rb
disco_app-0.7.1 app/models/disco_app/session_storage.rb
disco_app-0.7.2 app/models/disco_app/session_storage.rb
disco_app-0.8.0 app/models/disco_app/session_storage.rb
disco_app-0.8.1 app/models/disco_app/session_storage.rb
disco_app-0.8.2 app/models/disco_app/session_storage.rb
disco_app-0.8.3 app/models/disco_app/session_storage.rb
disco_app-0.8.4 app/models/disco_app/session_storage.rb
disco_app-0.8.5 app/models/disco_app/session_storage.rb