Class: Tinypass::RestrictionPolicy

Inherits:
Policy
  • Object
show all
Defined in:
lib/tinypass/policies/restriction_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

Methods inherited from Policy

#[]=, #initialize, #to_hash

Constructor Details

This class inherits a constructor from Tinypass::Policy

Class Method Details

.limit_purchases_in_period_by_amount(amount, within_period, link_with_details = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/tinypass/policies/restriction_policy.rb', line 3

def self.limit_purchases_in_period_by_amount(amount, within_period, link_with_details = nil)
  policy = new

  policy[POLICY_TYPE] = RESTRICT_MAX_PURCHASES
  policy['amount'] = amount
  policy['withinPeriod'] = within_period
  policy['linkWithDetails'] = link_with_details if link_with_details

  policy
end