class ParseData::WeatherChannelToday

Attributes

html[RW]

Public Class Methods

new(doc) click to toggle source
# File lib/parse_data.rb, line 129
def initialize(doc)
    self.html = Nokogiri::HTML(doc)
end

Public Instance Methods

current_temp() click to toggle source
# File lib/parse_data.rb, line 163
def current_temp
    self.html.css('div.today_nowcard div.today_nowcard-temp span').text
end
feels_like() click to toggle source
# File lib/parse_data.rb, line 159
def feels_like
    self.html.css('div.today_nowcard div.today_nowcard-feels span.deg-feels').text
end
humidity() click to toggle source
# File lib/parse_data.rb, line 195
def humidity
    wx_detail[1].text
end
long_detail() click to toggle source
# File lib/parse_data.rb, line 211
def long_detail
    self.html.css('div.dp-details span#dp0-details-narrative').text
end
max() click to toggle source
# File lib/parse_data.rb, line 167
def max
    self.html.css('div.today_nowcard-hilo span.deg-hilo-nowcard')[0].text
end
min() click to toggle source
# File lib/parse_data.rb, line 171
def min
    self.html.css('div.today_nowcard-hilo span.deg-hilo-nowcard')[1].text
end
panel0_precip() click to toggle source
# File lib/parse_data.rb, line 215
def panel0_precip
    self.html.css('div#daypart-0 span.precip-val').text
end
panel0_short_detail() click to toggle source
# File lib/parse_data.rb, line 227
def panel0_short_detail
    self.html.css('div#daypart-0 span.today-daypart-wxphrase').text
end
panel0_temp() click to toggle source
# File lib/parse_data.rb, line 251
def panel0_temp
    self.html.css('div#daypart-0 div.today-daypart-temp').text
end
panel0_text() click to toggle source
# File lib/parse_data.rb, line 239
def panel0_text
    self.html.css('div#daypart-0 span.today-daypart-title').text
end
panel1_precip() click to toggle source
# File lib/parse_data.rb, line 219
def panel1_precip
    self.html.css('div#daypart-1 span.precip-val').text
end
panel1_short_detail() click to toggle source
# File lib/parse_data.rb, line 231
def panel1_short_detail
    self.html.css('div#daypart-1 span.today-daypart-wxphrase').text
end
panel1_temp() click to toggle source
# File lib/parse_data.rb, line 255
def panel1_temp
    self.html.css('div#daypart-1 div.today-daypart-temp').text
end
panel1_text() click to toggle source
# File lib/parse_data.rb, line 243
def panel1_text
    self.html.css('div#daypart-1 span.today-daypart-title').text
end
panel2_precip() click to toggle source
# File lib/parse_data.rb, line 223
def panel2_precip
    self.html.css('div#daypart-2 span.precip-val').text
end
panel2_short_detail() click to toggle source
# File lib/parse_data.rb, line 235
def panel2_short_detail
    self.html.css('div#daypart-2 span.today-daypart-wxphrase').text
end
panel2_temp() click to toggle source
# File lib/parse_data.rb, line 259
def panel2_temp
    self.html.css('div#daypart-2 div.today-daypart-temp').text
end
panel2_text() click to toggle source
# File lib/parse_data.rb, line 247
def panel2_text
    self.html.css('div#daypart-2 span.today-daypart-title').text
end
return_hash() click to toggle source
# File lib/parse_data.rb, line 133
def return_hash
        {   :day => panel0_text,
            :panel1_name => panel1_text,
            :panel2_name => panel2_text,
            :current_temp => current_temp,
            :panel1_temp => panel1_temp,
            :panel2_temp => panel2_temp,
            :short_detail => panel0_short_detail,
            :panel1_short_detail => panel1_short_detail,
            :panel2_short_detail => panel2_short_detail,
            :precipitation => panel0_precip,
            :panel1_precip => panel1_precip,
            :panel2_precip => panel2_precip,
            :max => max,
            :min => min,
            :wind_direction => wind_direction,
            :wind_magnitude => wind_magnitude,
            :wind_units => wind_units,
            :long_detail => long_detail,
            :humidity => humidity,
            :uv_index => uv_index,
            :sunrise => sunrise,
            :sunset => sunset,
            :feels_like => feels_like}
end
sunrise() click to toggle source
# File lib/parse_data.rb, line 203
def sunrise
    wx_detail.css('span#dp0-details-sunrise').text.sub(' ', '')
end
sunset() click to toggle source
# File lib/parse_data.rb, line 207
def sunset
    wx_detail.css('span#dp0-details-sunset').text.sub(' ', '')
end
uv_index() click to toggle source
# File lib/parse_data.rb, line 199
def uv_index
    wx_detail[2].text.sub(' ', '')
end
wind() click to toggle source
# File lib/parse_data.rb, line 179
def wind
    wx_detail[0].text
end
wind_direction() click to toggle source
# File lib/parse_data.rb, line 187
def wind_direction
    wind.split(' ')[0]
end
wind_magnitude() click to toggle source
# File lib/parse_data.rb, line 191
def wind_magnitude
    wind.split(' ')[1]
end
wind_units() click to toggle source
# File lib/parse_data.rb, line 183
def wind_units
    wind.split(' ')[2]
end
wx_detail() click to toggle source
# File lib/parse_data.rb, line 175
def wx_detail
    self.html.css('div.looking-ahead.panel-footer li.wx-detail span.wx-detail-text span.wx-detail-value')
end