class Magentwo::SalesRule

Constants

Attributes

Public Class Methods

get_path() click to toggle source
# File lib/model/sales_rule.rb, line 21
def get_path
  "#{base_path}/search"
end
unique_identifier() click to toggle source
# File lib/model/sales_rule.rb, line 25
def unique_identifier
  :rule_id
end

Public Instance Methods

coupons() click to toggle source
# File lib/model/sales_rule.rb, line 11
def coupons
  self.check_presence :rule_id
  Magentwo::Coupon.filter(:rule_id => self.rule_id).all
end
generate(quantity:1, length:16, format:(:alpha), delimiter:"-", delimiter_at_every:4) click to toggle source
# File lib/model/sales_rule.rb, line 6
def generate quantity:1, length:16, format:(:alpha), delimiter:"-", delimiter_at_every:4
  self.check_presence :rule_id
  Magentwo::Coupon.generate self.rule_id, quantity:quantity, length:length, format:format, delimiter:delimiter, delimiter_at_every:delimiter_at_every
end
to_json() click to toggle source
# File lib/model/sales_rule.rb, line 16
def to_json
  Hash["rule", self.to_h].to_json
end