Class: SnesFinderCliApp::BestBuy

Inherits:
Object
  • Object
show all
Defined in:
lib/snes_finder_cli_app/snes_finder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBestBuy

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

#docObject

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_infoObject

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

#statusObject

Returns the value of attribute status.



2
3
4
# File 'lib/snes_finder_cli_app/snes_finder.rb', line 2

def status
  @status
end

#urlObject

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

#scraperObject



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