Class: Lita::Handlers::OnewheelOpenweathermap

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/onewheel_openweathermap.rb

Instance Method Summary collapse

Instance Method Details

#get_dataObject



16
17
18
19
20
21
# File 'lib/lita/handlers/onewheel_openweathermap.rb', line 16

def get_data
  uri = "http://api.openweathermap.org/v3/uvi/45.75,-122.75/#{Date.today.iso8601 + "Z"}.json?appid=#{config.api_key}"
  puts "getting #{uri}"
  data = RestClient.get uri
  JSON.parse data
end

#uv_index(response) ⇒ Object



10
11
12
13
14
# File 'lib/lita/handlers/onewheel_openweathermap.rb', line 10

def uv_index(response)
  data = get_data

  response.reply "UV index in Portland, OR is #{data['data']} today."
end