Class: Lita::Handlers::OnewheelGoogle
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::OnewheelGoogle
- Defined in:
- lib/lita/handlers/onewheel_google.rb
Instance Method Summary collapse
Instance Method Details
#search(response) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/lita/handlers/onewheel_google.rb', line 13 def search(response) query = response.matches[0][0] result = ::OnewheelGoogle::search(query, config.custom_search_engine_id, config.google_api_key, config.safe_search) reply = "#{result['items'][0]['link']} #{result['items'][0]['title']}: #{result['items'][0]['snippet']}".sub(/\n/, ' ')[0..500] response.reply reply end |