Skip to content

Commit

Permalink
updated html site; added d method for direct messaging but commented …
Browse files Browse the repository at this point in the history
…it out as api doesn't seem to work

git-svn-id: http://svn.addictedtonew.com/public/gems/twitter@48 fe7eae16-9a24-0410-a59d-9e59979e88be
  • Loading branch information
jnunemaker committed Apr 1, 2007
1 parent ab943d0 commit 13e031f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
0.1.0 - March 31, 2007
* added d method for creating direct messages (waiting for it to work as documented)
* added featured method for getting featured users statuses (waiting for it to work as documented)
* added direct_messages method
* added friends_for method
* added a few tests
* removed relative_created_at as it is deprecated
Expand Down
1 change: 1 addition & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ <h2>API Wrapping</h2>

<h2>Uses</h2>
<ul>
<li><a href="http://snitch.rubyforge.org">Snitch</a></li>
<li><a href="http://al3x.net/entries/766">Growl + Twitter</a></li>
<li><a href="http://snippets.dzone.com/posts/show/3714">Twitter Woot Bot</a> (<a href="http://soylentfoo.jnewland.com/articles/2007/03/22/woot-twitter-bot-now-official">more here</a>)</li>
<li><a href="http://soylentfoo.jnewland.com/articles/2007/01/22/tweet-update-twitter-via-quicksilver">Tweet Quicksilver Action</a></li>
Expand Down
18 changes: 16 additions & 2 deletions lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def followers
end

# waiting for twitter to correclty implement this in the api as it is documented
# TODO: uncomment this when it is working
# def featured
# users(call(:featured))
# end
Expand All @@ -62,6 +63,19 @@ def direct_messages(since=nil)
(doc/:direct_message).inject([]) { |dms, dm| dms << DirectMessage.new_from_xml(dm); dms }
end

# This api methods doesn't seem to be working
# TODO: uncomment this when it is working
# def d(user, msg)
# url = URI.parse("http://#{@@api_url}/statuses/update.xml")
#
# req = Net::HTTP::Post.new(url.path)
# req.basic_auth(@config[:email], @config[:password])
# req.set_form_data({'user' => user, 'msg' => msg})
#
# response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
# puts response.message,response.body
# end

# Updates your twitter with whatever status string is passed in
def post(status)
url = URI.parse("http://#{@@api_url}/statuses/update.xml")
Expand All @@ -70,8 +84,8 @@ def post(status)
req.basic_auth(@config[:email], @config[:password])
req.set_form_data({'status' => status})

result = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
Status.new_from_xml(parse(result.body).at('status'))
response = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
Status.new_from_xml(parse(response.body).at('status'))
end
alias :update :post

Expand Down

0 comments on commit 13e031f

Please sign in to comment.