From 3a9b0b1b390408b16a3a2ff9b8086d774e97f0ba Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Thu, 31 Jul 2008 00:29:17 -0400 Subject: [PATCH] Updated readme and website. --- README.txt | 11 ++++++----- website/index.html | 24 +++++++++++++++--------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/README.txt b/README.txt index 27818a2..0ed2f38 100644 --- a/README.txt +++ b/README.txt @@ -30,13 +30,14 @@ That works and all but what if you don't want to embed your username and passwor class Twitter include HTTParty base_uri 'twitter.com' - - def initialize(user, pass) - self.class.basic_auth user, pass + + def initialize(u, p) + @auth = {:username => u, :password => p} end - + def post(text) - self.class.post('/statuses/update.json', :query => {:status => text}) + options = { :query => {:status => text}, :basic_auth => @auth } + self.class.post('/statuses/update.json', options) end end diff --git a/website/index.html b/website/index.html index 7d255c7..02517cd 100644 --- a/website/index.html +++ b/website/index.html @@ -15,6 +15,7 @@ @@ -43,12 +44,13 @@ Twitter.post('/statuses/update.json', :query => {:status => "It's an HTTParty an include HTTParty base_uri 'twitter.com' - def initialize(user, pass) - self.class.basic_auth user, pass + def initialize(u, p) + @auth = {:username => u, :password => p} end def post(text) - self.class.post('/statuses/update.json', :query => {:status => text}) + options = { :query => {:status => text}, :basic_auth => @auth } + self.class.post('/statuses/update.json', options) end end @@ -66,12 +68,16 @@ Twitter.new('username', 'password').post("It's an HTTParty and everyone is invit

Created by John Nunemaker

+ + + - - - - - - \ No newline at end of file