Class: Tinypass::DiscountPolicy
- Defined in:
- lib/tinypass/policies/discount_policy.rb
Constant Summary
Constants inherited from Policy
Policy::DISCOUNT_PREVIOUS_PURCHASE, Policy::DISCOUNT_TOTAL_IN_PERIOD, Policy::POLICY_TYPE, Policy::REMINDER_METER_BY_COUNT, Policy::REMINDER_METER_BY_TIME, Policy::RESTRICT_MAX_PURCHASES, Policy::STRICT_METER_BY_TIME
Class Method Summary collapse
- .on_total_spend_in_period(amount, within_period, discount) ⇒ Object
- .previous_purchased(rids, discount) ⇒ Object
Methods inherited from Policy
Constructor Details
This class inherits a constructor from Tinypass::Policy
Class Method Details
.on_total_spend_in_period(amount, within_period, discount) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/tinypass/policies/discount_policy.rb', line 3 def self.on_total_spend_in_period(amount, within_period, discount) policy = new policy[POLICY_TYPE] = DISCOUNT_TOTAL_IN_PERIOD policy["amount"] = amount policy["withinPeriod"] = within_period policy["discount"] = discount policy end |
.previous_purchased(rids, discount) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tinypass/policies/discount_policy.rb', line 14 def self.previous_purchased(rids, discount) rids = Array(rids) policy = new policy[POLICY_TYPE] = DISCOUNT_PREVIOUS_PURCHASE policy["rids"] = rids policy["discount"] = discount policy end |