Class: WeatherScraper::WeeklyWeather

Inherits:
Object
  • Object
show all
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

Methods included from NameMapping

#city_mapping

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

#cityObject



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

def city
  @city
end

#weathersObject



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

def weathers
  @weathers ||= parse_weathers
end