Sha256: c2ec172b55b428eaf9c64b9065c4d72a9d84b51a368c61efb8e074b9a7d28f84
Contents?: true
Size: 1003 Bytes
Versions: 1
Compression:
Stored size: 1003 Bytes
Contents
dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) require File.join(dir, 'httpotato') require 'pp' config = YAML::load(File.read(File.join(ENV['HOME'], '.twitter'))) class Twitter include HTTPotato base_uri 'twitter.com' def initialize(u, p) @auth = {:username => u, :password => p} end # which can be :friends, :user or :public # options[:query] can be things like since, since_id, count, etc. def timeline(which=:friends, options={}) options.merge!({:basic_auth => @auth}) self.class.get("/statuses/#{which}_timeline.json", options) end def post(text) options = { :query => {:status => text}, :basic_auth => @auth } self.class.post('/statuses/update.json', options) end end twitter = Twitter.new(config['email'], config['password']) pp twitter.timeline # pp twitter.timeline(:friends, :query => {:since_id => 868482746}) # pp twitter.timeline(:friends, :query => 'since_id=868482746') # pp twitter.post('this is a test of 0.2.0')
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
httpotato-1.0.2 | examples/twitter.rb |