Sha256: 7945c2fecc8521b024514ecec6f28e81a204cf8a5cfae4250c5baed480936eb8

Contents?: true

Size: 648 Bytes

Versions: 10

Compression:

Stored size: 648 Bytes

Contents

class Activator < ActiveRecord::Base

  cattr_accessor :event_names

  self.event_names = [
    'spree.cart.add',
    'spree.checkout.coupon_code_added',
    'spree.order.contents_changed',
    'spree.user.signup'
  ]

  def self.register_event_name(name)
    self.event_names << name
  end

  scope :event_name_starts_with, lambda{|name| where('event_name like ?', "#{name}%") }
  scope :active, where('( starts_at IS NULL OR starts_at < ? ) AND ( expires_at IS NULL OR expires_at > ?)', Time.now, Time.now)

  def activate(payload)
  end

  def expired?
    starts_at && Time.now < starts_at ||
    expires_at && Time.now > expires_at
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_core-0.70.7 app/models/activator.rb
spree_core-0.70.6 app/models/activator.rb
spree_core-0.70.5 app/models/activator.rb
spree_core-0.70.4 app/models/activator.rb
spree_core-0.70.3 app/models/activator.rb
spree_core-0.70.2 app/models/activator.rb
spree_core-0.70.1 app/models/activator.rb
spree_core-0.70.0 app/models/activator.rb
spree_core-0.70.0.rc2 app/models/activator.rb
spree_core-0.70.RC1 app/models/activator.rb