lib/chatterbot/client.rb in chatterbot-0.6.2 vs lib/chatterbot/client.rb in chatterbot-0.6.3
- old
+ new
@@ -1,5 +1,7 @@
+require 'json'
+
module Chatterbot
#
# routines for connecting to Twitter and validating the bot
#
@@ -128,13 +130,13 @@
end
#
# query twitter for the bots screen name. we do this during the bot registration process
#
- def get_screen_name
+ def get_screen_name(t = @access_token)
return unless @screen_name.nil?
- oauth_response = @access_token.get('/1/account/verify_credentials.json')
+ oauth_response = t.get('/1/account/verify_credentials.json')
@screen_name = JSON.parse(oauth_response.body)["screen_name"]
end
#
# handle oauth for this request. if the client isn't authorized, print