Class: Lita::Handlers::Yo

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_config(config) ⇒ Object



5
6
7
# File 'lib/lita/handlers/yo.rb', line 5

def self.default_config(config)
  config.enabled = true
end

Instance Method Details

#yo(response) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/lita/handlers/yo.rb', line 13

def yo(response)
  yo_username = response.matches.first[0]
  puts "yo #{yo_username}"
  result = ::Net::HTTP.post_form(URI("http://api.justyo.co/yo/"),
                                     "api_token" => Lita.config.handlers.yo.api_key,
                                     "username" => yo_username)
  puts "response #{result.inspect}"
  response.reply("Just Yo'ed #{yo_username}")
end