Class: AirQualityIndex::Scraper
- Inherits:
-
Object
- Object
- AirQualityIndex::Scraper
- Defined in:
- lib/air_quality_index/scraper.rb
Instance Method Summary collapse
-
#local_aqi_scraper(zip_code) ⇒ Object
scrape AQI webpage based on submitted zip code.
-
#nationwide_aqi_scraper ⇒ Object
scrape main AQI website to grab top rankings for air quality.
-
#nationwide_scraper_more_info(link) ⇒ Object
scrape main AQI website to grab individual page from top ranking based on user input.
Instance Method Details
#local_aqi_scraper(zip_code) ⇒ Object
scrape AQI webpage based on submitted zip code
4 5 6 |
# File 'lib/air_quality_index/scraper.rb', line 4 def local_aqi_scraper(zip_code) Nokogiri::HTML(open("https://airnow.gov/index.cfm?action=airnow.local_city&zipcode=#{zip_code}")) end |
#nationwide_aqi_scraper ⇒ Object
scrape main AQI website to grab top rankings for air quality
9 10 11 |
# File 'lib/air_quality_index/scraper.rb', line 9 def nationwide_aqi_scraper Nokogiri::HTML(open("https://airnow.gov/index.cfm?action=airnow.main")) end |
#nationwide_scraper_more_info(link) ⇒ Object
scrape main AQI website to grab individual page from top ranking based on user input
14 15 16 |
# File 'lib/air_quality_index/scraper.rb', line 14 def nationwide_scraper_more_info(link) Nokogiri::HTML(open(link)) end |