Class: BestBuy::Conditions::MinPriceCondition

Inherits:
Object
  • Object
show all
Defined in:
lib/best_buy/helpers/conditions/min_price_condition.rb

Instance Method Summary collapse

Constructor Details

#initialize(condition_hash) ⇒ MinPriceCondition

Returns a new instance of MinPriceCondition.



6
7
8
# File 'lib/best_buy/helpers/conditions/min_price_condition.rb', line 6

def initialize(condition_hash)
  @min_price = condition_hash[:min_price]
end

Instance Method Details

#search_queryObject



14
15
16
# File 'lib/best_buy/helpers/conditions/min_price_condition.rb', line 14

def search_query
  "((regularPrice>=#{@min_price}&onSale=false)|(salePrice>=#{@min_price}&onSale=true))"
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/best_buy/helpers/conditions/min_price_condition.rb', line 10

def valid?
  @min_price.present?
end