Class: PricePulse::BestBuyParser

Inherits:
Object
  • Object
show all
Defined in:
lib/price_pulse/best_buy_parser.rb

Constant Summary collapse

BESTBUY_URL =

Placeholder for the Best Buy search URL

"https://www.bestbuy.com/site/searchpage.jsp?st="

Class Method Summary collapse

Class Method Details

.get_price(html_content) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/price_pulse/best_buy_parser.rb', line 8

def self.get_price(html_content)
  # Simulates finding the price in Best Buy's HTML structure
  if html_content.include?("Coffee")
    return 169.99
  elsif html_content.include?("Headphones")
    return 82.50
  else
    return nil
  end
end

.get_url(item_name) ⇒ Object



19
20
21
22
23
# File 'lib/price_pulse/best_buy_parser.rb', line 19

def self.get_url(item_name)
  # Creates a search URL for Best Buy
  search_term = item_name.gsub(' ', '+')
  "#{BESTBUY_URL}#{search_term}"
end