class Checkout
Attributes
adjustment[RW]
basket[RW]
promotional_rules[RW]
Public Class Methods
new(promotional_rules)
click to toggle source
# File lib/wunder/checkout.rb, line 7 def initialize(promotional_rules) @basket = Basket.new @promotional_rules = promotional_rules end
Public Instance Methods
applied_promotional_rules()
click to toggle source
# File lib/wunder/checkout.rb, line 25 def applied_promotional_rules adjustment.eligible_promotional_rules if adjustment end
remove_scan(product)
click to toggle source
# File lib/wunder/checkout.rb, line 16 def remove_scan(product) basket.remove_item(product) end
scan(product)
click to toggle source
# File lib/wunder/checkout.rb, line 12 def scan(product) basket.add_item(product) end
total()
click to toggle source
# File lib/wunder/checkout.rb, line 20 def total @adjustment = Adjustment.new(basket, promotional_rules) @adjustment.calculate_total end