Class: Weather

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/rateless_bot/plugins/weather.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Weather

Returns a new instance of Weather.



12
13
14
15
# File 'lib/rateless_bot/plugins/weather.rb', line 12

def initialize(*args)
  super
  @options = { units: 'metric', APPID: config[:api_key] }
end

Instance Method Details

#execute(m) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/rateless_bot/plugins/weather.rb', line 19

def execute(m)
  city = m.message.split('!weather ')[1]

  current_weather = OpenWeather::Current.city(city, @options)

  m.reply make_current_weather_str(current_weather)
end

#helpObject



6
7
8
# File 'lib/rateless_bot/plugins/weather.rb', line 6

def help
  '!weather CITY/ZIP - gets the current temperature for a given city/zip'
end