Sha256: 6ef898f56b4e63f006bcbb5365d35cf303cdba1c87a6c6effe2d763226b041a8

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

module StreamBot
  # wrapper class for dealing with twitters native retweet api
  class Retweet
    # api base url   
    $BASE_URL = "http://api.twitter.com/1/" 
    
    # intitialize method aka constructor
    def initialize(auth)
      @auth = auth
      @http = StreamBot::HTTP.new
    end
    
    # retweets the status with given id
    def retweet(id)
      LOG.debug("#{self.class}#retweet")
      res = @http.post_with_auth(@auth, "#{$BASE_URL}statuses/retweet/#{id}.json")
      case res
        when Net::HTTPSuccess then return res
      else 
        res.error!
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
streambot-0.3.0 lib/streambot/retweet.rb