Commits

Richo Healey committed c855c11

Pull ye' Twitter auth out into it's own method. YARR.

Comments (0)

Files changed (1)

lib/twat/actions.rb

 
     def tweet(opts)
       # This is all broken, we should know what options we have before this happend
-      conf = cf[opts[:account]]
-
-      Twitter.configure do |twit|
-        conf.each do |key, value|
-          twit.send("#{key}=", value)
-        end
-        Config.consumer_info.each do |key, value|
-          twit.send("#{key}=", value)
-        end
-      end
+      twitter_auth(opts)
 
       Twitter.update(opts.msg)
       #puts opts.msg
     end
 
     def show(opts)
+      twitter_auth(opts)
       puts "#{opts[:count]} Tweets XD"
     end
 
       @cf ||= Config.new
     end
 
+    def twitter_auth(opts)
+      conf = cf[opts[:account]]
+      Twitter.configure do |twit|
+        conf.each do |key, value|
+          twit.send("#{key}=", value)
+        end
+        Config.consumer_info.each do |key, value|
+          twit.send("#{key}=", value)
+        end
+      end
+    end
+
   end
 end