lib/kosher/offer.rb in kosher-0.16.0 vs lib/kosher/offer.rb in kosher-0.17.0
- old
+ new
@@ -1,23 +1,24 @@
module Kosher
class Offer < Structure
include Comparable
- key :kosher, Boolean
- key :new, Boolean
- key :shipping, Shipping
- key :seller
- key :unit, Unit
+ one :condition
+ one :shipping
+ one :seller
+ one :unit
+ one :venue
- alias kosher? kosher
- alias new? new
-
def <=>(other)
if kosher? != other.kosher?
kosher? ? -1 : 1
else
price <=> other.price
end
+ end
+
+ def kosher?
+ condition.kosher? && seller.kosher? && shipping.kosher?
end
def price
unit.price + shipping.cost
end