facebooker 1.0.63 → 1.0.64

Sign up to get free protection for your applications and to get access to all the features.
@@ -1532,3 +1532,4 @@ class RailsRequestFormatTest < Test::Unit::TestCase
1532
1532
  end
1533
1533
 
1534
1534
  end
1535
+
@@ -246,6 +246,13 @@ class TestFacebooker < Test::Unit::TestCase
246
246
  assert_raise(ArgumentError) { @session.get_photos() }
247
247
  end
248
248
 
249
+ def test_can_get_comments_by_xid
250
+ expect_http_posts_with_responses(example_comments_xml)
251
+ comments = @session.get_comments('pete_comments')
252
+ assert_equal('Hola', comments[0].text)
253
+ assert_equal(2, comments.size)
254
+ end
255
+
249
256
  def test_can_get_albums_for_user
250
257
  expect_http_posts_with_responses(example_user_albums_xml)
251
258
  assert_equal('Summertime is Best', @session.user.albums.first.name)
@@ -259,6 +266,13 @@ class TestFacebooker < Test::Unit::TestCase
259
266
  assert_equal('Bonofon\'s Recital', albums[1].name)
260
267
  end
261
268
 
269
+ def test_can_get_stream
270
+ expect_http_posts_with_responses(example_user_stream_xml)
271
+ stream = @session.get_stream(100000637452380)
272
+ assert stream[:albums].empty?
273
+ assert_equal('The bbc home page', stream[:posts].first['message'])
274
+ end
275
+
262
276
  def test_can_create_album
263
277
  expect_http_posts_with_responses(example_new_album_xml)
264
278
  assert_equal "My Empty Album", @session.user.create_album(:name => "My Empty Album", :location => "Limboland").name
@@ -377,6 +391,20 @@ class TestFacebooker < Test::Unit::TestCase
377
391
  assert_equal false, @session.post('facebook.auth.revokeAuthorization', :uid => 123)
378
392
  end
379
393
 
394
+
395
+
396
+ def test_remove_comment_true
397
+ expect_http_posts_with_responses(example_remove_comment_true)
398
+ assert_equal true, @session.remove_comment('pete_comments',123)
399
+ end
400
+
401
+ def test_remove_comment_false
402
+ expect_http_posts_with_responses(example_remove_comment_false)
403
+ assert_equal false, @session.remove_comment('pete_comments',123)
404
+ end
405
+
406
+
407
+
380
408
  private
381
409
  def populate_user_info
382
410
  mock_http = establish_session
@@ -812,6 +840,28 @@ class TestFacebooker < Test::Unit::TestCase
812
840
  XML
813
841
  end
814
842
 
843
+ def example_comments_xml
844
+ <<-XML
845
+ <?xml version="1.0" encoding="UTF-8"?>
846
+ <comments_get_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true">
847
+ <comment>
848
+ <xid>pete_comments</xid>
849
+ <fromid>563683308</fromid>
850
+ <time>1234227529</time>
851
+ <text>Hola</text>
852
+ <id>65020</id>
853
+ </comment>
854
+ <comment>
855
+ <xid>pete_comments</xid>
856
+ <fromid>563683308</fromid>
857
+ <time>1234227542</time>
858
+ <text>holla</text>
859
+ <id>65021</id>
860
+ </comment>
861
+ </comments_get_response>
862
+ XML
863
+ end
864
+
815
865
  def example_user_albums_xml
816
866
  <<-XML
817
867
  <?xml version="1.0" encoding="UTF-8"?>
@@ -844,6 +894,170 @@ class TestFacebooker < Test::Unit::TestCase
844
894
  XML
845
895
  end
846
896
 
897
+ def example_user_stream_xml
898
+ <<-XML
899
+ <?xml version="1.0" encoding="UTF-8"?>
900
+ <stream_get_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
901
+ <posts list="true">
902
+ <stream_post>
903
+ <post_id>100000637452380_329182455865</post_id>
904
+ <viewer_id>100000637452380</viewer_id>
905
+ <source_id>100000637452380</source_id>
906
+ <type>80</type>
907
+ <app_id>2309869772</app_id>
908
+ <attribution xsi:nil="true"/>
909
+ <actor_id>100000637452380</actor_id>
910
+ <target_id xsi:nil="true"/>
911
+ <message>The bbc home page</message>
912
+ <attachment>
913
+ <media list="true">
914
+ <stream_media>
915
+ <href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.bbc.co.uk%252F&amp;h=d6020258c74e511ee6dc1c28746f1e31</href>
916
+ <type>link</type>
917
+ <src>http://external.ak.fbcdn.net/safe_image.php?d=d1e587ce2d7039feaceaf7ef4c2610cd&amp;w=90&amp;h=90&amp;url=http%3A%2F%2Fwww.bbc.co.uk%2Ffeedengine%2Fhomepage%2Fimages%2F_47351229_-1_201x150.jpg</src>
918
+ </stream_media>
919
+ </media>
920
+ <name>BBC - Homepage</name>
921
+ <href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.bbc.co.uk%252F&amp;h=d6020258c74e511ee6dc1c28746f1e31</href>
922
+ <caption>www.bbc.co.uk</caption>
923
+ <description>Breaking news, sport, TV, radio and a whole lot more. The BBC informs, educates and entertains - wherever you are, whatever your age.</description>
924
+ <properties list="true"/>
925
+ <icon>http://static.ak.fbcdn.net/rsrc.php/zAXEX/hash/9yvl71tw.png</icon>
926
+ <fb_object_type/>
927
+ <fb_object_id/>
928
+ </attachment>
929
+ <app_data/>
930
+ <action_links xsi:nil="true"/>
931
+ <comments>
932
+ <can_remove>1</can_remove>
933
+ <can_post>1</can_post>
934
+ <count>1</count>
935
+ <comment_list list="true">
936
+ <comment>
937
+ <fromid>100000702701175</fromid>
938
+ <time>1267118534</time>
939
+ <text>I like this website!</text>
940
+ <id>100000637452380_329182455865_11562840</id>
941
+ </comment>
942
+ </comment_list>
943
+ </comments>
944
+ <likes>
945
+ <href>http://www.facebook.com/social_graph.php?node_id=329182455865&amp;class=LikeManager</href>
946
+ <count>1</count>
947
+ <sample list="true"/>
948
+ <friends list="true">
949
+ <uid>100000702701175</uid>
950
+ </friends>
951
+ <user_likes>0</user_likes>
952
+ <can_like>1</can_like>
953
+ </likes>
954
+ <privacy>
955
+ <description>Everyone</description>
956
+ <value>EVERYONE</value>
957
+ <friends>NO_FRIENDS</friends>
958
+ <networks/>
959
+ <allow/>
960
+ <deny/>
961
+ </privacy>
962
+ <updated_time>1267118534</updated_time>
963
+ <created_time>1267103491</created_time>
964
+ <tagged_ids list="true"/>
965
+ <is_hidden>0</is_hidden>
966
+ <filter_key/>
967
+ <permalink>http://www.facebook.com/profile.php?v=feed&amp;story_fbid=329182455865&amp;id=100000637452380</permalink>
968
+ </stream_post>
969
+ <stream_post>
970
+ <post_id>100000637452380_318491734561</post_id>
971
+ <viewer_id>100000637452380</viewer_id>
972
+ <source_id>100000637452380</source_id>
973
+ <type>237</type>
974
+ <app_id>22108119377</app_id>
975
+ <attribution>Digg.com</attribution>
976
+ <actor_id>100000637452380</actor_id>
977
+ <target_id xsi:nil="true"/>
978
+ <message>What is curling.</message>
979
+ <attachment>
980
+ <media list="true">
981
+ <stream_media>
982
+ <href>http://digg.com/olympics/Curling_Finally_Explained_InfoGraphic?OTC-fbc8</href>
983
+ <type>link</type>
984
+ <src>http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=22108119377&amp;v=1&amp;size=z&amp;cksum=f8ecb50623115ff74e5ea8acd9cf4a2e&amp;src=http%3A%2F%2Fdigg.com%2Folympics%2FCurling_Finally_Explained_InfoGraphic%2Ft.jpg</src>
985
+ </stream_media>
986
+ </media>
987
+ <name>Curling Finally Explained [InfoGraphic]</name>
988
+ <href>http://digg.com/olympics/Curling_Finally_Explained_InfoGraphic?OTC-fbc1</href>
989
+ <caption>Phudki dugg this story on Digg</caption>
990
+ <description>At last, someone makes sense out of the weirdest sport of the Winter Olympics. </description>
991
+ <properties list="true">
992
+ <stream_property>
993
+ <name>Source</name>
994
+ <text>i.imgur.com</text>
995
+ </stream_property>
996
+ <stream_property>
997
+ <name>Diggs</name>
998
+ <text>247</text>
999
+ </stream_property>
1000
+ </properties>
1001
+ <icon>http://photos-b.ak.fbcdn.net/photos-ak-sf2p/v43/113/22108119377/app_2_22108119377_6404.gif</icon>
1002
+ <fb_object_type/>
1003
+ <fb_object_id/>
1004
+ </attachment>
1005
+ <app_data>
1006
+ <attachment_data>{&quot;name&quot;:&quot;Curling Finally Explained [InfoGraphic]&quot;,&quot;href&quot;:&quot;http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic?OTC-fbc1&quot;,&quot;description&quot;:&quot;At last, someone makes sense out of the weirdest sport of the Winter Olympics. &quot;,&quot;media&quot;:[{&quot;type&quot;:&quot;image&quot;,&quot;src&quot;:&quot;http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic\/t.jpg&quot;,&quot;href&quot;:&quot;http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic?OTC-fbc8&quot;}],&quot;caption&quot;:&quot;{*actor*} dugg this story on Digg&quot;,&quot;properties&quot;:{&quot;Source&quot;:&quot;i.imgur.com&quot;,&quot;Diggs&quot;:&quot;247&quot;}}</attachment_data>
1007
+ <images>[{&quot;fbml&quot;:&quot;&lt;img src=\&quot;http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic\/t.jpg\&quot; \/&gt;&quot;,&quot;href&quot;:&quot;http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic?OTC-fbc8&quot;}]</images>
1008
+ </app_data>
1009
+ <action_links xsi:nil="true"/>
1010
+ <comments>
1011
+ <can_remove>1</can_remove>
1012
+ <can_post>1</can_post>
1013
+ <count>0</count>
1014
+ <comment_list list="true"/>
1015
+ </comments>
1016
+ <likes>
1017
+ <href>http://www.facebook.com/social_graph.php?node_id=318491734561&amp;class=LikeManager</href>
1018
+ <count>0</count>
1019
+ <sample list="true"/>
1020
+ <friends list="true"/>
1021
+ <user_likes>0</user_likes>
1022
+ <can_like>1</can_like>
1023
+ </likes>
1024
+ <privacy>
1025
+ <description>Everyone</description>
1026
+ <value>EVERYONE</value>
1027
+ <friends>NO_FRIENDS</friends>
1028
+ <networks/>
1029
+ <allow/>
1030
+ <deny/>
1031
+ </privacy>
1032
+ <updated_time>1266919509</updated_time>
1033
+ <created_time>1266919509</created_time>
1034
+ <tagged_ids list="true"/>
1035
+ <is_hidden>0</is_hidden>
1036
+ <filter_key/>
1037
+ <permalink>http://www.facebook.com/profile.php?v=feed&amp;story_fbid=318491734561&amp;id=100000637452380</permalink>
1038
+ </stream_post>
1039
+ </posts>
1040
+ <profiles list="true">
1041
+ <profile>
1042
+ <id>100000637452380</id>
1043
+ <url>http://www.facebook.com/profile.php?id=100000637452380</url>
1044
+ <name>Phudki Bandar</name>
1045
+ <pic_square>http://profile.ak.fbcdn.net/v22939/1286/112/q100000637452380_2062.jpg</pic_square>
1046
+ <type>user</type>
1047
+ </profile>
1048
+ <profile>
1049
+ <id>100000702701175</id>
1050
+ <url>http://www.facebook.com/profile.php?id=100000702701175</url>
1051
+ <name>Mahmood Tester</name>
1052
+ <pic_square>http://profile.ak.fbcdn.net/v22940/1631/70/q100000702701175_5464.jpg</pic_square>
1053
+ <type>user</type>
1054
+ </profile>
1055
+ </profiles>
1056
+ <albums list="true"/>
1057
+ </stream_get_response>
1058
+ XML
1059
+ end
1060
+
847
1061
  def example_upload_photo_xml
848
1062
  <<-XML
849
1063
  <?xml version="1.0" encoding="UTF-8"?>
@@ -948,4 +1162,14 @@ class TestFacebooker < Test::Unit::TestCase
948
1162
  def example_revoke_authorization_false
949
1163
  "0"
950
1164
  end
1165
+
1166
+
1167
+ def example_remove_comment_true
1168
+ "1"
1169
+ end
1170
+
1171
+ def example_remove_comment_false
1172
+ "0"
1173
+ end
1174
+
951
1175
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebooker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.63
4
+ version: 1.0.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Fowler
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-02-22 00:00:00 -05:00
17
+ date: 2010-02-26 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -127,6 +127,7 @@ files:
127
127
  - lib/facebooker/models/applicationproperties.rb
128
128
  - lib/facebooker/models/applicationrestrictions.rb
129
129
  - lib/facebooker/models/cookie.rb
130
+ - lib/facebooker/models/comment.rb
130
131
  - lib/facebooker/models/education_info.rb
131
132
  - lib/facebooker/models/event.rb
132
133
  - lib/facebooker/models/family_relative_info.rb