class SkiReport::Report

Public Class Methods

print_report(state) click to toggle source
scrape_ots(state_url) click to toggle source
# File lib/ski_report/report.rb, line 3
def self.scrape_ots(state_url)
  resorts = []
  doc = Nokogiri::HTML(open("http://www.onthesnow.com/" + state_url + "/skireport.html?&ud=1&o=resort"))
  doc.css(".resScrollCol8 table tr").each do |resort|
    if resort.css('.name').text != ""
      new_resort = {
        :name => resort.css('.name').text,
        :twofour => resort.css('.rLeft b').first.text.slice(/\d+/),
        :seventwo => resort.css('.rLeft b').last.text.slice(/\d+/),
        :base => resort.css('.rMid b').text
      }
      resorts << new_resort
    end
  end
  resorts
end