Class: BestBuy::Conditions::MaxPriceCondition
- Inherits:
-
Object
- Object
- BestBuy::Conditions::MaxPriceCondition
- Defined in:
- lib/best_buy/helpers/conditions/max_price_condition.rb
Instance Method Summary collapse
-
#initialize(condition_hash) ⇒ MaxPriceCondition
constructor
A new instance of MaxPriceCondition.
- #search_query ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(condition_hash) ⇒ MaxPriceCondition
Returns a new instance of MaxPriceCondition.
6 7 8 |
# File 'lib/best_buy/helpers/conditions/max_price_condition.rb', line 6 def initialize(condition_hash) @max_price = condition_hash[:max_price] end |
Instance Method Details
#search_query ⇒ Object
14 15 16 |
# File 'lib/best_buy/helpers/conditions/max_price_condition.rb', line 14 def search_query "((regularPrice<=#{@max_price}&onSale=false)|(salePrice<=#{@max_price}&onSale=true))" end |
#valid? ⇒ Boolean
10 11 12 |
# File 'lib/best_buy/helpers/conditions/max_price_condition.rb', line 10 def valid? @max_price.present? end |