lib/retweet.rb in streambot-0.2.1 vs lib/retweet.rb in streambot-0.2.2
- old
+ new
@@ -1,14 +1,16 @@
require 'net/http'
require 'open-uri'
class Retweet
+ # intitialize method aka constructor
def initialize(auth)
return if auth.nil?
@auth = auth
end
+ # retweets the status with given id
def retweet(id)
url = URI.parse("http://api.twitter.com/1/statuses/retweet/#{id}.json")
req = Net::HTTP::Post.new(url.path)
req.basic_auth @auth[:username],@auth[:password]
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
\ No newline at end of file