Slide 22
Slide 22 text
class Order
...
def ship
case @store.shipping_method
when Shipping::RegularMethod
@store.shipping_method.pack(@items, @buyer, @seller).ship
when Shipping::OvernightMethod
origin = @seller.address
destination = “#{@buyer.address_line1}, #{@buyer.zip}"
@store.shipping_method.ship_order(origin, destination, @items)
when Shipping::SameDayMethod
addresses = [@seller.address, @buyer.complete_address]
@store.shipping_method.pack(@items, addresses).send
end
end
...
end