Class: WeatherScraper::DailyWeather

Inherits:
Object
  • Object
show all
Includes:
NameMapping
Defined in:
lib/weathers/weather_scraper/daily_weather.rb

Overview

parse daily weather description from cwb website

Constant Summary collapse

CWB_URL =
"http://www.cwb.gov.tw"
CITY_WEATHER_URL =
"#{CWB_URL}/V7/forecast/taiwan/"

Instance Method Summary collapse

Methods included from NameMapping

#city_mapping

Constructor Details

#initialize(city) ⇒ DailyWeather

Returns a new instance of DailyWeather.



12
13
14
15
# File 'lib/weathers/weather_scraper/daily_weather.rb', line 12

def initialize(city)
  @city = city_mapping(city).delete("_")
  parse_html(city_mapping(city))
end

Instance Method Details

#cityObject



17
18
19
# File 'lib/weathers/weather_scraper/daily_weather.rb', line 17

def city
  @city
end

#tipsObject



25
26
27
# File 'lib/weathers/weather_scraper/daily_weather.rb', line 25

def tips
  @tips ||= parse_tips
end

#weathersObject



21
22
23
# File 'lib/weathers/weather_scraper/daily_weather.rb', line 21

def weathers
  @weathers ||= parse_weathers
end