Class: SnesFinderCliApp::BestBuy
- Inherits:
-
Object
- Object
- SnesFinderCliApp::BestBuy
- Defined in:
- lib/snes_finder_cli_app/snes_finder.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#more_info ⇒ Object
Returns the value of attribute more_info.
-
#status ⇒ Object
Returns the value of attribute status.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize ⇒ BestBuy
constructor
A new instance of BestBuy.
- #scraper ⇒ Object
Constructor Details
#initialize ⇒ BestBuy
Returns a new instance of BestBuy.
4 5 6 |
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 4 def initialize @url = "https://www.bestbuy.com/site/nintendo-entertainment-system-snes-classic-edition/5919830.p?skuId=5919830" end |
Instance Attribute Details
#doc ⇒ Object
Returns the value of attribute doc.
2 3 4 |
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 2 def doc @doc end |
#more_info ⇒ Object
Returns the value of attribute more_info.
2 3 4 |
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 2 def more_info @more_info end |
#status ⇒ Object
Returns the value of attribute status.
2 3 4 |
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 2 def status @status end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 2 def url @url end |
Instance Method Details
#scraper ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 8 def scraper browser = Watir::Browser.new :chrome, headless: true browser.goto @url @doc = Nokogiri::HTML.parse(browser.html) browser.close @more_info = @doc.css("#long-description").text @status = @doc.css(".cart-button").text end |