Class: WeatherScraper::WeeklyWeather
- Inherits:
-
Object
- Object
- WeatherScraper::WeeklyWeather
- Includes:
- NameMapping
- Defined in:
- lib/weathers/weather_scraper/weekly_weather.rb
Overview
parse weekly weather description from cwb website
Constant Summary collapse
- CWB_URL =
"http://www.cwb.gov.tw"
- CITY_WEATHER_URL =
"#{CWB_URL}/V7/forecast/taiwan/inc/city"
Instance Method Summary collapse
- #city ⇒ Object
-
#initialize(city) ⇒ WeeklyWeather
constructor
A new instance of WeeklyWeather.
- #weathers ⇒ Object
Methods included from NameMapping
Constructor Details
#initialize(city) ⇒ WeeklyWeather
Returns a new instance of WeeklyWeather.
12 13 14 15 |
# File 'lib/weathers/weather_scraper/weekly_weather.rb', line 12 def initialize(city) @city = city_mapping(city).delete("_") parse_html(city_mapping(city)) end |
Instance Method Details
#city ⇒ Object
17 18 19 |
# File 'lib/weathers/weather_scraper/weekly_weather.rb', line 17 def city @city end |
#weathers ⇒ Object
21 22 23 |
# File 'lib/weathers/weather_scraper/weekly_weather.rb', line 21 def weathers @weathers ||= parse_weathers end |