Class: PricePulse::WalmartParser
- Inherits:
-
Object
- Object
- PricePulse::WalmartParser
- Defined in:
- lib/price_pulse/walmart_parser.rb
Constant Summary collapse
- WALMART_URL =
Placeholder for the Walmart search URL
"https://www.walmart.com/search?q="
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/walmart_parser.rb', line 8 def self.get_price(html_content) # Simulates finding the price in Walmart's HTML structure if html_content.include?("Coffee") return 175.00 elsif html_content.include?("Headphones") return 88.99 else return nil end end |
.get_url(item_name) ⇒ Object
19 20 21 22 23 |
# File 'lib/price_pulse/walmart_parser.rb', line 19 def self.get_url(item_name) # Creates a search URL for Walmart search_term = item_name.gsub(' ', '+') "#{WALMART_URL}#{search_term}" end |