-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renamed my test files correctly with _test suffix, woops; added direc…
…t_messages method which gets all the direct_messages for the authorized user git-svn-id: http://svn.addictedtonew.com/public/gems/twitter@44 fe7eae16-9a24-0410-a59d-9e59979e88be
- Loading branch information
jnunemaker
committed
Apr 1, 2007
1 parent
21ca95f
commit 0f4d699
Showing
16 changed files
with
144 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Twitter | ||
class DirectMessage | ||
include EasyClassMaker | ||
|
||
attributes :id, :text, :sender_id, :recipient_id, :created_at, :sender_screen_name, :recipient_screen_name | ||
|
||
class << self | ||
# Creates a new status from a piece of xml | ||
def new_from_xml(xml) | ||
DirectMessage.new do |d| | ||
d.id = (xml).at('id').innerHTML | ||
d.text = (xml).at('text').innerHTML | ||
d.sender_id = (xml).at('sender_id').innerHTML | ||
d.recipient_id = (xml).at('recipient_id').innerHTML | ||
d.created_at = (xml).at('created_at').innerHTML | ||
d.sender_screen_name = (xml).at('sender_screen_name').innerHTML | ||
d.recipient_screen_name = (xml).at('recipient_screen_name').innerHTML | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class BaseTest < Test::Unit::TestCase | ||
def setup | ||
@t = Twitter::Base.new(CONFIG['email'], CONFIG['password']) | ||
end | ||
|
||
test 'should have friend and public class level timelines' do | ||
assert_equal 3, Twitter::Base.timelines.size | ||
end | ||
|
||
test 'should be able to get public timeline' do | ||
puts 'Public Timeline', @t.timeline(:public), "*"*50 | ||
end | ||
|
||
test 'should be able to get friends timeline' do | ||
puts 'Friends Timeline', @t.timeline(:friends), "*"*50 | ||
end | ||
|
||
test 'should be able to get user timeline' do | ||
puts 'User Timeline', @t.timeline(:user), "*"*50 | ||
end | ||
|
||
test 'should be able to get friends for auth user' do | ||
puts 'Friends', @t.friends, "*"*50 | ||
end | ||
|
||
test 'should be able to get friends for another user' do | ||
puts 'Friends For', @t.friends_for('jnunemaker'), "*"*50 | ||
end | ||
|
||
test 'should be able to get followers for auth user' do | ||
puts 'Followers', @t.followers, "*"*50 | ||
end | ||
|
||
test 'should be able to get direct messages for auth user' do | ||
puts 'Direct Messages', @t.direct_messages, "*"*50 | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require File.dirname(__FILE__) + '/../test_helper' | ||
|
||
class DirectMessageTest < Test::Unit::TestCase | ||
def setup | ||
@xml = <<EOF | ||
<direct_message> | ||
<id>331681</id> | ||
<text>thanks for revving the twitter gem! had notice that it was broken but didn't have time to patch.</text> | ||
<sender_id>18713</sender_id> | ||
<recipient_id>4243</recipient_id> | ||
<created_at>Sat Mar 10 22:10:37 +0000 2007</created_at> | ||
<sender_screen_name>al3x</sender_screen_name> | ||
<recipient_screen_name>jnunemaker</recipient_screen_name> | ||
</direct_message> | ||
EOF | ||
end | ||
|
||
test 'should create new from xml' do | ||
d = Twitter::DirectMessage.new do |d| | ||
d.id = '331681' | ||
d.text = "thanks for revving the twitter gem! had notice that it was broken but didn't have time to patch." | ||
d.sender_id = '18713' | ||
d.recipient_id = '4243' | ||
d.created_at = 'Sat Mar 10 22:10:37 +0000 2007' | ||
d.sender_screen_name = 'al3x' | ||
d.recipient_screen_name = 'jnunemaker' | ||
end | ||
d2 = Twitter::DirectMessage.new_from_xml(Hpricot.XML(@xml)) | ||
|
||
assert_equal d.id, d2.id | ||
assert_equal d.text, d2.text | ||
assert_equal d.sender_id, d2.sender_id | ||
assert_equal d.recipient_id, d2.recipient_id | ||
assert_equal d.created_at, d2.created_at | ||
assert_equal d.sender_screen_name, d2.sender_screen_name | ||
assert_equal d.recipient_screen_name, d2.recipient_screen_name | ||
end | ||
|
||
end |
Empty file.
File renamed without changes.
File renamed without changes.