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 invitCreated by John Nunemaker
+ + + - - - - - -