# this was added to support the idea of an anonymous user interacting with our site; needed by the ShoppingCart # over time it might make sense to beef this up and to use it conistently in anonymous interactions module JamRuby class AnonymousUser attr_accessor :id, :cookies def initialize(id, cookies) @id = id @cookies = cookies end def shopping_carts ShoppingCart.where(anonymous_user_id: @id).order('created_at DESC') end def destroy_all_shopping_carts ShoppingCart.destroy_all(anonymous_user_id: @id) end def admin false end def has_redeemable_jamtrack APP_CONFIG.one_free_jamtrack_per_user && !@cookies[:redeemed_jamtrack] end def signup_hint SignupHint.where(anonymous_user_id: @id).where('expires_at > ?', Time.now).first end end end