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.8.6 app/models/disco_app/session_storage.rb
disco_app-0.8.7 app/models/disco_app/session_storage.rb
disco_app-0.8.8 app/models/disco_app/session_storage.rb
disco_app-0.8.9 app/models/disco_app/session_storage.rb
disco_app-0.9.0 app/models/disco_app/session_storage.rb
disco_app-0.9.1 app/models/disco_app/session_storage.rb
disco_app-0.9.2 app/models/disco_app/session_storage.rb
disco_app-0.9.3 app/models/disco_app/session_storage.rb
disco_app-0.9.4 app/models/disco_app/session_storage.rb
disco_app-0.9.5 app/models/disco_app/session_storage.rb
disco_app-0.9.6 app/models/disco_app/session_storage.rb
disco_app-0.9.7 app/models/disco_app/session_storage.rb
disco_app-0.9.8 app/models/disco_app/session_storage.rb
disco_app-0.9.9 app/models/disco_app/session_storage.rb
disco_app-0.9.10 app/models/disco_app/session_storage.rb
disco_app-0.9.11 app/models/disco_app/session_storage.rb
disco_app-0.10.0 app/models/disco_app/session_storage.rb
disco_app-0.10.1 app/models/disco_app/session_storage.rb
disco_app-0.10.2 app/models/disco_app/session_storage.rb
disco_app-0.10.3 app/models/disco_app/session_storage.rb