This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| 8e143785 » | jnunemaker | 2008-07-27 | 1 | dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')) | |
| 1d48da03 » | jnunemaker | 2008-07-28 | 2 | require File.join(dir, 'httparty') | |
| de9b4fb6 » | jnunemaker | 2008-07-27 | 3 | require 'pp' | |
| 8e143785 » | jnunemaker | 2008-07-27 | 4 | config = YAML::load(File.read(File.join(ENV['HOME'], '.twitter'))) | |
| 5 | |||||
| 6 | class Twitter | ||||
| 1d48da03 » | jnunemaker | 2008-07-28 | 7 | include HTTParty | |
| 8e143785 » | jnunemaker | 2008-07-27 | 8 | base_uri 'twitter.com' | |
| de9b4fb6 » | jnunemaker | 2008-07-27 | 9 | ||
| 3a8ad1da » | jnunemaker | 2008-07-30 | 10 | def initialize(u, p) | |
| 11 | @auth = {:username => u, :password => p} | ||||
| 13620e30 » | jnunemaker | 2008-07-27 | 12 | end | |
| 13 | |||||
| aafde867 » | jnunemaker | 2008-07-28 | 14 | # which can be :friends, :user or :public | |
| 15 | # options[:query] can be things like since, since_id, count, etc. | ||||
| 99cd89d3 » | jnunemaker | 2008-07-27 | 16 | def timeline(which=:friends, options={}) | |
| 3a8ad1da » | jnunemaker | 2008-07-30 | 17 | options.merge!({:basic_auth => @auth}) | |
| 18 | self.class.get("/statuses/#{which}_timeline.json", options) | ||||
| 99cd89d3 » | jnunemaker | 2008-07-27 | 19 | end | |
| 20 | |||||
| 21 | def post(text) | ||||
| 3a8ad1da » | jnunemaker | 2008-07-30 | 22 | options = { :query => {:status => text}, :basic_auth => @auth } | |
| 23 | self.class.post('/statuses/update.json', options) | ||||
| 13620e30 » | jnunemaker | 2008-07-27 | 24 | end | |
| 8e143785 » | jnunemaker | 2008-07-27 | 25 | end | |
| 26 | |||||
| 13620e30 » | jnunemaker | 2008-07-27 | 27 | twitter = Twitter.new(config['email'], config['password']) | |
| 3a8ad1da » | jnunemaker | 2008-07-30 | 28 | pp twitter.timeline | |
| 29 | # pp twitter.timeline(:friends, :query => {:since_id => 868482746}) | ||||
| 9b423a22 » | jnunemaker | 2008-07-30 | 30 | # pp twitter.timeline(:friends, :query => 'since_id=868482746') | |
| 05c388dc » | jnunemaker | 2008-12-06 | 31 | # pp twitter.post('this is a test of 0.2.0') | |









