Module: WeatherJp

Defined in:
lib/weather_jp.rb,
lib/weather_jp/city.rb,
lib/weather_jp/adapter.rb,
lib/weather_jp/version.rb,
lib/weather_jp/weather.rb,
lib/weather_jp/day_weather.rb,
lib/weather_jp/request_parser.rb

Defined Under Namespace

Modules: RequestParser Classes: Adapter, City, DayWeather, ServiceUnavailable, Weather, WeatherJpError

Constant Summary collapse

VERSION =
"2.0.0"

Class Method Summary collapse

Class Method Details

.get(city_name) ⇒ WeatherJp::Weather?

Parameters:

  • city_name (String)

Returns:



24
25
26
# File 'lib/weather_jp.rb', line 24

def get(city_name)
  Adapter.get(city_name)
end

.parse(query) ⇒ WeatherJp::Weather?

Request like ‘明日の東京の天気教えて’.

Parameters:

  • query (String)

Returns:



31
32
33
34
35
# File 'lib/weather_jp.rb', line 31

def parse(query)
  if request = RequestParser.parser(query)
    get(request.city).get_weather(request.day)
  end
end