facebooker-micah 1.0.74

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/.autotest +15 -0
  2. data/CHANGELOG.rdoc +24 -0
  3. data/COPYING.rdoc +19 -0
  4. data/Manifest.txt +152 -0
  5. data/README.rdoc +119 -0
  6. data/Rakefile +94 -0
  7. data/TODO.rdoc +4 -0
  8. data/examples/desktop_login.rb +14 -0
  9. data/facebooker.gemspec +42 -0
  10. data/generators/facebook/facebook_generator.rb +14 -0
  11. data/generators/facebook/templates/config/facebooker.yml +49 -0
  12. data/generators/facebook/templates/public/javascripts/facebooker.js +93 -0
  13. data/generators/facebook_controller/USAGE +33 -0
  14. data/generators/facebook_controller/facebook_controller_generator.rb +40 -0
  15. data/generators/facebook_controller/templates/controller.rb +7 -0
  16. data/generators/facebook_controller/templates/functional_test.rb +11 -0
  17. data/generators/facebook_controller/templates/helper.rb +2 -0
  18. data/generators/facebook_controller/templates/view.fbml.erb +2 -0
  19. data/generators/facebook_controller/templates/view.html.erb +2 -0
  20. data/generators/facebook_publisher/facebook_publisher_generator.rb +14 -0
  21. data/generators/facebook_publisher/templates/create_facebook_templates.rb +15 -0
  22. data/generators/facebook_publisher/templates/publisher.rb +3 -0
  23. data/generators/facebook_scaffold/USAGE +27 -0
  24. data/generators/facebook_scaffold/facebook_scaffold_generator.rb +118 -0
  25. data/generators/facebook_scaffold/templates/controller.rb +93 -0
  26. data/generators/facebook_scaffold/templates/facebook_style.css +2579 -0
  27. data/generators/facebook_scaffold/templates/functional_test.rb +89 -0
  28. data/generators/facebook_scaffold/templates/helper.rb +2 -0
  29. data/generators/facebook_scaffold/templates/layout.fbml.erb +6 -0
  30. data/generators/facebook_scaffold/templates/layout.html.erb +17 -0
  31. data/generators/facebook_scaffold/templates/style.css +74 -0
  32. data/generators/facebook_scaffold/templates/view_edit.fbml.erb +13 -0
  33. data/generators/facebook_scaffold/templates/view_edit.html.erb +18 -0
  34. data/generators/facebook_scaffold/templates/view_index.fbml.erb +24 -0
  35. data/generators/facebook_scaffold/templates/view_index.html.erb +24 -0
  36. data/generators/facebook_scaffold/templates/view_new.fbml.erb +12 -0
  37. data/generators/facebook_scaffold/templates/view_new.html.erb +17 -0
  38. data/generators/facebook_scaffold/templates/view_show.fbml.erb +10 -0
  39. data/generators/facebook_scaffold/templates/view_show.html.erb +10 -0
  40. data/generators/publisher/publisher_generator.rb +14 -0
  41. data/generators/xd_receiver/templates/xd_receiver.html +10 -0
  42. data/generators/xd_receiver/templates/xd_receiver_ssl.html +10 -0
  43. data/generators/xd_receiver/xd_receiver_generator.rb +10 -0
  44. data/init.rb +28 -0
  45. data/install.rb +12 -0
  46. data/lib/facebooker.rb +261 -0
  47. data/lib/facebooker/adapters/adapter_base.rb +91 -0
  48. data/lib/facebooker/adapters/bebo_adapter.rb +77 -0
  49. data/lib/facebooker/adapters/facebook_adapter.rb +60 -0
  50. data/lib/facebooker/admin.rb +42 -0
  51. data/lib/facebooker/application.rb +37 -0
  52. data/lib/facebooker/attachment.rb +59 -0
  53. data/lib/facebooker/batch_request.rb +45 -0
  54. data/lib/facebooker/data.rb +57 -0
  55. data/lib/facebooker/feed.rb +78 -0
  56. data/lib/facebooker/logging.rb +44 -0
  57. data/lib/facebooker/mobile.rb +20 -0
  58. data/lib/facebooker/mock/service.rb +50 -0
  59. data/lib/facebooker/mock/session.rb +18 -0
  60. data/lib/facebooker/model.rb +139 -0
  61. data/lib/facebooker/models/affiliation.rb +10 -0
  62. data/lib/facebooker/models/album.rb +11 -0
  63. data/lib/facebooker/models/applicationproperties.rb +39 -0
  64. data/lib/facebooker/models/applicationrestrictions.rb +10 -0
  65. data/lib/facebooker/models/comment.rb +9 -0
  66. data/lib/facebooker/models/cookie.rb +10 -0
  67. data/lib/facebooker/models/education_info.rb +11 -0
  68. data/lib/facebooker/models/event.rb +28 -0
  69. data/lib/facebooker/models/family_relative_info.rb +7 -0
  70. data/lib/facebooker/models/friend_list.rb +16 -0
  71. data/lib/facebooker/models/group.rb +36 -0
  72. data/lib/facebooker/models/info_item.rb +10 -0
  73. data/lib/facebooker/models/info_section.rb +10 -0
  74. data/lib/facebooker/models/location.rb +8 -0
  75. data/lib/facebooker/models/message_thread.rb +89 -0
  76. data/lib/facebooker/models/notifications.rb +17 -0
  77. data/lib/facebooker/models/page.rb +46 -0
  78. data/lib/facebooker/models/photo.rb +19 -0
  79. data/lib/facebooker/models/tag.rb +12 -0
  80. data/lib/facebooker/models/user.rb +761 -0
  81. data/lib/facebooker/models/video.rb +9 -0
  82. data/lib/facebooker/models/work_info.rb +10 -0
  83. data/lib/facebooker/parser.rb +980 -0
  84. data/lib/facebooker/rails/backwards_compatible_param_checks.rb +31 -0
  85. data/lib/facebooker/rails/controller.rb +353 -0
  86. data/lib/facebooker/rails/cucumber.rb +28 -0
  87. data/lib/facebooker/rails/cucumber/world.rb +40 -0
  88. data/lib/facebooker/rails/extensions/action_controller.rb +48 -0
  89. data/lib/facebooker/rails/extensions/rack_setup.rb +16 -0
  90. data/lib/facebooker/rails/extensions/routing.rb +15 -0
  91. data/lib/facebooker/rails/facebook_form_builder.rb +141 -0
  92. data/lib/facebooker/rails/facebook_pretty_errors.rb +22 -0
  93. data/lib/facebooker/rails/facebook_request_fix.rb +28 -0
  94. data/lib/facebooker/rails/facebook_request_fix_2-3.rb +31 -0
  95. data/lib/facebooker/rails/facebook_session_handling.rb +68 -0
  96. data/lib/facebooker/rails/facebook_url_helper.rb +192 -0
  97. data/lib/facebooker/rails/facebook_url_rewriting.rb +60 -0
  98. data/lib/facebooker/rails/helpers.rb +835 -0
  99. data/lib/facebooker/rails/helpers/fb_connect.rb +165 -0
  100. data/lib/facebooker/rails/helpers/stream_publish.rb +22 -0
  101. data/lib/facebooker/rails/integration_session.rb +38 -0
  102. data/lib/facebooker/rails/profile_publisher_extensions.rb +42 -0
  103. data/lib/facebooker/rails/publisher.rb +608 -0
  104. data/lib/facebooker/rails/routing.rb +49 -0
  105. data/lib/facebooker/rails/test_helpers.rb +68 -0
  106. data/lib/facebooker/rails/utilities.rb +22 -0
  107. data/lib/facebooker/server_cache.rb +24 -0
  108. data/lib/facebooker/service.rb +103 -0
  109. data/lib/facebooker/service/base_service.rb +19 -0
  110. data/lib/facebooker/service/curl_service.rb +44 -0
  111. data/lib/facebooker/service/net_http_service.rb +12 -0
  112. data/lib/facebooker/service/typhoeus_multi_service.rb +27 -0
  113. data/lib/facebooker/service/typhoeus_service.rb +17 -0
  114. data/lib/facebooker/session.rb +788 -0
  115. data/lib/facebooker/stream_post.rb +19 -0
  116. data/lib/facebooker/version.rb +9 -0
  117. data/lib/net/http_multipart_post.rb +123 -0
  118. data/lib/rack/facebook.rb +89 -0
  119. data/lib/rack/facebook_session.rb +21 -0
  120. data/lib/tasks/facebooker.rake +19 -0
  121. data/lib/tasks/facebooker.rb +2 -0
  122. data/lib/tasks/tunnel.rake +46 -0
  123. data/rails/init.rb +1 -0
  124. data/setup.rb +1585 -0
  125. data/templates/layout.erb +24 -0
  126. data/test/facebooker/adapters_test.rb +191 -0
  127. data/test/facebooker/admin_test.rb +102 -0
  128. data/test/facebooker/application_test.rb +110 -0
  129. data/test/facebooker/attachment_test.rb +72 -0
  130. data/test/facebooker/batch_request_test.rb +83 -0
  131. data/test/facebooker/data_test.rb +86 -0
  132. data/test/facebooker/logging_test.rb +43 -0
  133. data/test/facebooker/mobile_test.rb +45 -0
  134. data/test/facebooker/model_test.rb +133 -0
  135. data/test/facebooker/models/event_test.rb +15 -0
  136. data/test/facebooker/models/page_test.rb +56 -0
  137. data/test/facebooker/models/photo_test.rb +16 -0
  138. data/test/facebooker/models/user_test.rb +1087 -0
  139. data/test/facebooker/rails/facebook_request_fix_2-3_test.rb +25 -0
  140. data/test/facebooker/rails/facebook_url_rewriting_test.rb +76 -0
  141. data/test/facebooker/rails/integration_session_test.rb +13 -0
  142. data/test/facebooker/rails/publisher_test.rb +538 -0
  143. data/test/facebooker/rails_integration_test.rb +1543 -0
  144. data/test/facebooker/server_cache_test.rb +44 -0
  145. data/test/facebooker/service_test.rb +58 -0
  146. data/test/facebooker/session_test.rb +883 -0
  147. data/test/facebooker_test.rb +1263 -0
  148. data/test/fixtures/multipart_post_body_with_only_parameters.txt +33 -0
  149. data/test/fixtures/multipart_post_body_with_single_file.txt +38 -0
  150. data/test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt +38 -0
  151. data/test/net/http_multipart_post_test.rb +52 -0
  152. data/test/rack/facebook_session_test.rb +34 -0
  153. data/test/rack/facebook_test.rb +73 -0
  154. data/test/rails_test_helper.rb +36 -0
  155. data/test/test_helper.rb +74 -0
  156. metadata +300 -0
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
+ require 'active_support'
3
+
4
+ class Facebooker::UserTest < Test::Unit::TestCase
5
+
6
+ def test_pid_should_be_treated_as_a_string
7
+ @photo = Facebooker::Photo.new(:pid=>"100000025509592_6801")
8
+ assert_equal("100000025509592_6801",@photo.pid)
9
+ end
10
+
11
+ def test_setting_id_should_also_use_new_method
12
+ @photo = Facebooker::Photo.new(:id=>"100000025509592_6801")
13
+ assert_equal("100000025509592_6801",@photo.id)
14
+ end
15
+
16
+ end
@@ -0,0 +1,1087 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
+ require 'active_support'
3
+
4
+ class Facebooker::UserTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ @session = Facebooker::Session.create('apikey', 'secretkey')
8
+ @user = Facebooker::User.new(1234, @session)
9
+ @other_user = Facebooker::User.new(4321, @session)
10
+ ENV['FACEBOOK_CANVAS_PATH'] ='facebook_app_name'
11
+ ENV['FACEBOOK_API_KEY'] = '1234567'
12
+ ENV['FACEBOOK_SECRET_KEY'] = '7654321'
13
+
14
+ @user.friends = [@other_user]
15
+ end
16
+
17
+ def test_has_permission
18
+ expect_http_posts_with_responses(has_app_permission_response_xml)
19
+ assert @user.has_permission?("status_update")
20
+ end
21
+
22
+ def test_has_permissions
23
+ expect_http_posts_with_responses(has_app_permission_response_xml, has_app_permission_response_xml)
24
+ assert @user.has_permissions?(["status_update", "read_stream"])
25
+ end
26
+
27
+ def test_app_user_should_return_false_if_facebook_returns_one
28
+ expect_http_posts_with_responses(is_app_user_true_response_xml)
29
+ assert @user.app_user?
30
+ end
31
+
32
+ def test_app_user_should_return_false_if_facebook_does_not_return_one
33
+ expect_http_posts_with_responses(is_app_user_false_response_xml)
34
+ assert !@user.app_user?
35
+ end
36
+
37
+ def test_can_ask_user_if_he_or_she_is_friends_with_another_user
38
+ assert(@user.friends_with?(@other_user))
39
+ end
40
+
41
+ def test_can_ask_user_if_he_or_she_is_friends_with_another_user_by_user_id
42
+ assert(@user.friends_with?(@other_user.id))
43
+ end
44
+
45
+ def test_does_not_query_facebook_for_uid
46
+ @session.expects(:post).never
47
+ assert_equal 1234, Facebooker::User.new(1234, @session).uid
48
+ end
49
+
50
+ def test_uid_is_always_an_integer
51
+ assert_equal 1234, Facebooker::User.new(:uid => "1234").uid
52
+ assert_equal 1234, Facebooker::User.new(:id => "1234").uid
53
+
54
+ assert_equal 1234, Facebooker::User.new(:uid => "1234").id
55
+ assert_equal 1234, Facebooker::User.new(:id => "1234").id
56
+
57
+ assert_equal 1234, Facebooker::User.new(:uid => "1234").facebook_id
58
+ assert_equal 1234, Facebooker::User.new(:id => "1234").facebook_id
59
+ end
60
+
61
+ def test_cast_to_friend_list_id_with_nil
62
+ assert_nil @user.cast_to_friend_list_id(nil)
63
+ end
64
+ def test_cast_to_friend_list_id_with_integer
65
+ assert_equal 14,@user.cast_to_friend_list_id(14)
66
+ end
67
+ def test_cast_to_friend_list_id_with_string
68
+ @user.expects(:friend_lists).returns([Facebooker::FriendList.new(:flid=>199,:name=>"Work")])
69
+ assert_equal 199,@user.cast_to_friend_list_id("Work")
70
+ end
71
+ def test_cast_to_friend_list_id_with_friend_list
72
+ assert_equal 199,@user.cast_to_friend_list_id(Facebooker::FriendList.new(:flid=>199,:name=>"Work"))
73
+ end
74
+
75
+ def test_cast_to_friend_list_id_with_invalid_string_raises
76
+ @user.expects(:friend_lists).returns([Facebooker::FriendList.new(:flid=>1,:name=>"Not Picked")])
77
+ assert_nil @user.cast_to_friend_list_id("Something")
78
+ fail("No exception raised, Expected Facebooker::Session::InvalidFriendList")
79
+ rescue Facebooker::Session::InvalidFriendList
80
+ nil
81
+ end
82
+
83
+ def test_can_create_from_current_session
84
+ Facebooker::Session.expects(:current).returns("current")
85
+ user=Facebooker::User.new(1)
86
+ assert_equal("current",user.session)
87
+ end
88
+
89
+ def test_raises_when_no_session_bound
90
+ assert_raises(Facebooker::Model::UnboundSessionException) { Facebooker::User.new(1, nil).populate }
91
+ end
92
+
93
+ def test_passes_request_locale_when_set
94
+ session = mock()
95
+ session.expects(:post).with("facebook.users.getInfo",has_entry(:locale,"es_ES"))
96
+ Facebooker::Session.expects(:current).returns(session)
97
+ user=Facebooker::User.new(1)
98
+ user.request_locale="es_ES"
99
+ user.name
100
+
101
+ end
102
+
103
+ def test_doesnt_pass_request_locale_when_not_set
104
+ session = mock()
105
+ session.expects(:post).with("facebook.users.getInfo",Not(has_key(:locale)))
106
+ Facebooker::Session.expects(:current).returns(session)
107
+ user=Facebooker::User.new(1)
108
+ user.name
109
+
110
+ end
111
+
112
+ def test_can_set_mobile_fbml
113
+ @user.expects(:set_profile_fbml).with(nil,"test",nil,nil)
114
+ @user.mobile_fbml="test"
115
+ end
116
+ def test_can_set_profile_action
117
+ @user.expects(:set_profile_fbml).with(nil,nil,"test",nil)
118
+ @user.profile_action="test"
119
+ end
120
+ def test_can_set_profile_fbml
121
+ @user.expects(:set_profile_fbml).with("test",nil,nil,nil)
122
+ @user.profile_fbml="test"
123
+ end
124
+
125
+ def test_can_set_profile_main
126
+ @user.expects(:set_profile_fbml).with(nil,nil,nil,"test")
127
+ @user.profile_main="test"
128
+ end
129
+
130
+
131
+ def test_can_call_get_status
132
+ @session.expects(:post).with('facebook.status.get', {:uid => 1234, :limit => 4}).returns([{ "time" => 1233804858, "source" => 6628568379, "message" => "my message rocks!", "status_id" => 61436484312, 'uid' => 1234 }])
133
+ st = @user.statuses( 4 )
134
+ assert_equal st.size, 1
135
+ assert_equal st.first.message, 'my message rocks!'
136
+ end
137
+
138
+ def test_can_call_set_profile_fbml
139
+ @session.expects(:post).with('facebook.profile.setFBML', {:uid=>1234,:profile=>"profile",:profile_action=>"action",:mobile_profile=>"mobile"},false)
140
+ @user.set_profile_fbml("profile","mobile","action")
141
+ end
142
+
143
+ def test_can_call_set_profile_fbml_with_profile_main
144
+ @session.expects(:post).with('facebook.profile.setFBML', {:uid=>1234,:profile=>"profile",:profile_action=>"action",:mobile_profile=>"mobile", :profile_main => 'profile_main'},false)
145
+ @user.set_profile_fbml("profile","mobile","action",'profile_main')
146
+ end
147
+
148
+ def test_can_get_profile_photos
149
+ @user.expects(:profile_photos)
150
+ @user.profile_photos
151
+ end
152
+
153
+ def test_can_set_cookie
154
+ @user.expects(:set_cookie).with('name', 'value')
155
+ @user.set_cookie('name', 'value')
156
+ end
157
+
158
+ def test_can_get_cookies
159
+ @user.expects(:get_cookies).with('name')
160
+ @user.get_cookies('name')
161
+ end
162
+
163
+ def test_get_profile_photos
164
+ @user = Facebooker::User.new(548871286, @session)
165
+ expect_http_posts_with_responses(example_profile_photos_get_xml)
166
+ photos = @user.profile_photos
167
+ assert_equal "2357384227378429949", photos.first.aid
168
+ end
169
+
170
+ def test_prepare_publish_to_options_pass_only_neccessary_parameters
171
+ options = @user.prepare_publish_to_options(@user, {:message => 'Hey there', :action_links => [:text => 'Link', :href => 'http://example.com']})
172
+ assert_equal(options[:uid], @user.uid)
173
+ assert_equal(options[:target_id], @user.id)
174
+ assert_equal(options[:message], 'Hey there')
175
+ assert_nil(options[:attachment])
176
+ assert_equal(options[:action_links], [:text => 'Link', :href => 'http://example.com'].to_json )
177
+ end
178
+
179
+ def test_prepare_publish_to_options_to_page_on_behave_of_page
180
+ page_id = 12345678
181
+ options = @user.prepare_publish_to_options(@user, {:uid => 12345678, :post_as_page => true, :message => 'Hey there', :action_links => [:text => 'Link', :href => 'http://example.com']})
182
+ assert_equal(options[:uid], page_id)
183
+ assert_nil(options[:target_id])
184
+ assert_equal(options[:message], 'Hey there')
185
+ assert_nil(options[:attachment])
186
+ assert_equal(options[:action_links], [:text => 'Link', :href => 'http://example.com'].to_json )
187
+ end
188
+
189
+ def test_publish_to
190
+ @user = Facebooker::User.new(548871286, @session)
191
+ expect_http_posts_with_responses(example_profile_publish_to_get_xml)
192
+ @user.publish_to(@other_user, :message => 'i love you man')
193
+ end
194
+
195
+ def test_publish_to_converts_attachment_to_json
196
+ @user = Facebooker::User.new(548871286, @session)
197
+ @user.session.expects(:post).with("facebook.stream.publish",has_entry(:attachment=>instance_of(String)),false)
198
+ @user.publish_to(@other_user, :message => 'i love you man',:attachment=>{:a=>"b"})
199
+ end
200
+
201
+ def test_publish_to_converts_attachment_from_attachment_objecect
202
+ @user = Facebooker::User.new(548871286, @session)
203
+ @user.session.expects(:post).with("facebook.stream.publish",has_entry(:attachment=>instance_of(String)),false)
204
+ attachment = Facebooker::Attachment.new
205
+ attachment.name = "My name"
206
+ @user.publish_to(@other_user, :message => 'i love you man',:attachment=>attachment)
207
+ end
208
+
209
+ def test_comment_on
210
+ @user = Facebooker::User.new(548871286, @session)
211
+ expect_http_posts_with_responses(example_comment_on_response)
212
+ assert_equal('703826862_78463536863', @user.comment_on('703826862_78463536862', :message => 'that was hilarious!'))
213
+ end
214
+
215
+ def test_add_comment
216
+ @user = Facebooker::User.new(548871286, @session)
217
+ expect_http_posts_with_responses(example_add_comment_response)
218
+ assert_equal('403917', @user.add_comment('test_xid','that was realy hilarious!') )
219
+ end
220
+
221
+ def test_add_like_on
222
+ @user = Facebooker::User.new(548871286, @session)
223
+ expect_http_posts_with_responses(example_add_like_on_response)
224
+ assert_equal('1', @user.add_like_on('703826862_78463536862'))
225
+ end
226
+
227
+ def test_remove_like_on
228
+ @user = Facebooker::User.new(548871286, @session)
229
+ expect_http_posts_with_responses(example_remove_like_on_response)
230
+ assert_equal(true, @user.remove_like_on('703826862_78463536862'))
231
+ end
232
+
233
+ def test_can_send_email
234
+ @user.expects(:send_email).with("subject", "body text")
235
+ @user.send_email("subject", "body text")
236
+
237
+ @user.expects(:send_email).with("subject", nil, "body fbml")
238
+ @user.send_email("subject", nil, "body fbml")
239
+ end
240
+
241
+ def test_doesnt_post_to_facebook_when_assigning_status
242
+ @session.expects(:post).never
243
+ @user.status="my status"
244
+ end
245
+ def test_can_set_status_with_string
246
+ @session.expects(:post).with('facebook.users.setStatus', {:status=>"my status",:status_includes_verb=>1, :uid => @user.uid}, false)
247
+ @user.set_status("my status")
248
+ end
249
+
250
+ def test_get_events
251
+ @user = Facebooker::User.new(9507801, @session)
252
+ expect_http_posts_with_responses(example_events_get_xml)
253
+ events = @user.events
254
+ assert_equal 29511517904, events.first.eid
255
+ end
256
+
257
+ def test_events_caching_honors_params
258
+ @user = Facebooker::User.new(9507801, @session)
259
+ @session.expects(:post).returns([{:eid=>1}])
260
+ assert_equal 1,@user.events.first.eid
261
+ @session.expects(:post).returns([{:eid=>2}])
262
+ assert_equal 2,@user.events(:start_time=>1.day.ago).first.eid
263
+ @session.expects(:post).never
264
+ assert_equal 1,@user.events.first.eid
265
+ end
266
+
267
+
268
+ def test_to_s
269
+ assert_equal("1234",@user.to_s)
270
+ end
271
+
272
+ def test_equality_with_same_id
273
+ assert_equal @user, @user.dup
274
+ assert_equal @user, Facebooker::User.new(:id => @user.id)
275
+ end
276
+
277
+ def test_not_equal_to_differnt_class
278
+ assert_not_equal @user, flexmock(:id => @user.id)
279
+ end
280
+
281
+ def test_hash_email
282
+ assert_equal "4228600737_c96da02bba97aedfd26136e980ae3761", Facebooker::User.hash_email("mary@example.com")
283
+ end
284
+ def test_hash_email_not_normalized
285
+ assert_equal "4228600737_c96da02bba97aedfd26136e980ae3761", Facebooker::User.hash_email(" MaRy@example.com ")
286
+ end
287
+
288
+ def test_register_with_array
289
+ expect_http_posts_with_responses(register_response_xml)
290
+ assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.register([{:email=>"mary@example.com",:account_id=>1}])
291
+ end
292
+
293
+ def test_unregister_with_array
294
+ expect_http_posts_with_responses(unregister_response_xml)
295
+ assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.unregister(["4228600737_c96da02bba97aedfd26136e980ae3761"])
296
+ end
297
+
298
+ def test_unregister_emails_with_array
299
+ expect_http_posts_with_responses(unregister_response_xml)
300
+ assert_equal ["mary@example.com"],Facebooker::User.unregister_emails(["mary@example.com"])
301
+ end
302
+
303
+ def test_register_with_array_raises_if_not_all_success
304
+ expect_http_posts_with_responses(register_response_xml)
305
+ assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.register([{:email=>"mary@example.com",:account_id=>1},{:email=>"mike@example.com",:account_id=>2}])
306
+ fail "Should have raised Facebooker::Session::UserRegistrationFailed"
307
+ rescue Facebooker::Session::UserRegistrationFailed => e
308
+ assert_equal({:email=>"mike@example.com",:account_id=>2},e.failed_users.first)
309
+ end
310
+
311
+ def test_unregister_with_array_raises_if_not_all_success
312
+ expect_http_posts_with_responses(unregister_response_xml)
313
+ assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.unregister(["4228600737_c96da02bba97aedfd26136e980ae3761","3587916587_791214eb452bf4de30e957d65a0234d4"])
314
+ fail "Should have raised Facebooker::Session::UserUnRegistrationFailed"
315
+ rescue Facebooker::Session::UserUnRegistrationFailed => e
316
+ assert_equal("3587916587_791214eb452bf4de30e957d65a0234d4",e.failed_users.first)
317
+ end
318
+
319
+ def test_unregister_emails_with_array_raises_if_not_all_success
320
+ expect_http_posts_with_responses(unregister_response_xml)
321
+ assert_equal ["mary@example.com"],Facebooker::User.unregister_emails(["mary@example.com","mike@example.com"])
322
+ fail "Should have raised Facebooker::Session::UserUnRegistrationFailed"
323
+ rescue Facebooker::Session::UserUnRegistrationFailed => e
324
+ assert_equal("mike@example.com",e.failed_users.first)
325
+ end
326
+
327
+
328
+ def test_get_locale
329
+ @user = Facebooker::User.new(9507801, @session)
330
+ expect_http_posts_with_responses(example_users_get_info_xml)
331
+ assert_equal "en_US", @user.locale
332
+ end
333
+
334
+ def test_get_profile_url
335
+ @user = Facebooker::User.new(8055, @session)
336
+ expect_http_posts_with_responses(example_users_get_info_xml)
337
+ assert_equal "http://www.facebook.com/profile.php?id=8055", @user.profile_url
338
+ end
339
+
340
+ def test_can_rsvp_to_event
341
+ expect_http_posts_with_responses(example_events_rsvp_xml)
342
+ result = @user.rsvp_event(1000, 'attending')
343
+ assert result
344
+ end
345
+
346
+ # Dashboard count APIs
347
+
348
+ def test_can_set_dashboard_count
349
+ @session.expects(:post).with('facebook.dashboard.setCount', {:uid => @user.uid, :count => 12})
350
+ @user.dashboard_count = 12
351
+ end
352
+
353
+ def test_parse_set_dashboard_count
354
+ expect_http_posts_with_responses(dashboard_set_count_xml)
355
+ assert_equal 12, @user.dashboard_count = 12
356
+ end
357
+
358
+ def test_can_increment_dashboard_count
359
+ @session.expects(:post).with('facebook.dashboard.incrementCount', {:uid => @user.uid})
360
+ @user.dashboard_increment_count
361
+ end
362
+
363
+ def test_parse_increment_dashboard_count
364
+ expect_http_posts_with_responses(dashboard_increment_count_xml)
365
+ assert_equal true, @user.dashboard_increment_count
366
+ end
367
+
368
+ def test_can_decrement_dashboard_count
369
+ @session.expects(:post).with('facebook.dashboard.decrementCount', {:uid => @user.uid})
370
+ @user.dashboard_decrement_count
371
+ end
372
+
373
+ def test_parse_decrement_dashboard_count
374
+ expect_http_posts_with_responses(dashboard_decrement_count_xml)
375
+ assert_equal true, @user.dashboard_decrement_count
376
+ end
377
+
378
+ def test_can_get_dashboard_count
379
+ @session.expects(:post).with('facebook.dashboard.getCount', {:uid => @user.uid}).returns(12)
380
+ @user.dashboard_count
381
+ end
382
+
383
+ def test_threads_should_return_an_array_of_thread_instances_containing_messages_and_attachments
384
+ expect_http_posts_with_responses(example_threads)
385
+ threads = @user.threads
386
+ assert_not_nil threads
387
+ assert_instance_of Array, threads
388
+ assert_operator threads.size, :>, 0
389
+ for thread in threads
390
+ assert_instance_of Facebooker::MessageThread, thread
391
+ assert_instance_of Array, thread.messages
392
+ assert_operator thread.messages.size, :>, 0
393
+ assert_instance_of Facebooker::MessageThread::Message, thread.messages.first
394
+
395
+ for message in thread.messages
396
+ next if message.attachment.blank?
397
+ assert_instance_of Facebooker::MessageThread::Message::Attachment, message.attachment
398
+
399
+ case message.message_id
400
+ when '1344434538976_0'
401
+ assert message.attachment.photo?, 'Attachment of message "1344434538976_0" should be a photo'
402
+ when '1344434538976_2'
403
+ assert message.attachment.link?, 'Attachment of message "1344434538976_2" should be a link'
404
+ when '1012985167472_0'
405
+ assert message.attachment.video?, 'Attachment of message "1012985167472_0" should be a video'
406
+ end
407
+ end
408
+ end
409
+ end
410
+
411
+ def test_threads_should_return_populated_fields
412
+ expect_http_posts_with_responses(example_threads)
413
+ threads = @user.threads
414
+
415
+ thread = threads.first
416
+ [:thread_id, :subject, :updated_time, :recipients, :parent_message_id, :parent_thread_id,
417
+ :message_count, :snippet, :snippet_author, :object_id, :unread].each do |field|
418
+ assert_not_nil thread.__send__(field), "Field #{field} should not be nil"
419
+ end
420
+ end
421
+
422
+ def test_parse_get_dashboard_count
423
+ expect_http_posts_with_responses(dashboard_get_count_xml)
424
+ assert_equal '12', @user.dashboard_count
425
+ end
426
+
427
+ def test_can_dashboard_multi_set_count
428
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiSetCount', :ids => { '1234' => '11', '5678' => '22' }.to_json)
429
+ Facebooker::User.dashboard_multi_set_count({ '1234' => '11', '5678' => '22' })
430
+ end
431
+
432
+ def test_parse_dashboard_multi_set_count
433
+ expect_http_posts_with_responses(dashboard_multi_set_count_xml)
434
+ assert_equal({ '1234' => true, '4321' => true }, Facebooker::User.dashboard_multi_set_count({ '1234' => '11', '5678' => '22' }))
435
+ end
436
+
437
+ def test_can_dashboard_multi_get_count
438
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiGetCount', :uids => ['1234', '4321'])
439
+ Facebooker::User.dashboard_multi_get_count ['1234', '4321']
440
+ end
441
+
442
+ def test_parse_dashboard_multi_get_count
443
+ expect_http_posts_with_responses(dashboard_multi_get_count_xml)
444
+ assert_equal({ '1234' => '11', '4321' => '22' }, Facebooker::User.dashboard_multi_get_count(['1234', '4321']))
445
+ end
446
+
447
+ def test_can_dashboard_multi_increment_count_with_single_uid
448
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiIncrementCount', :uids => ['8675309'].to_json)
449
+ Facebooker::User.dashboard_multi_increment_count 8675309
450
+ end
451
+
452
+ def test_can_dashboard_multi_increment_count_with_multiple_uids
453
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiIncrementCount', :uids => ['8675309', '555'].to_json)
454
+ Facebooker::User.dashboard_multi_increment_count 8675309, 555
455
+ end
456
+
457
+ def test_can_dashboard_multi_increment_count_with_array_of_uids
458
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiIncrementCount', :uids => ['1234', '4321'].to_json)
459
+ Facebooker::User.dashboard_multi_increment_count ['1234', '4321']
460
+ end
461
+
462
+ def test_parse_dashboard_multi_increment_count
463
+ expect_http_posts_with_responses(dashboard_multi_increment_count_xml)
464
+ assert_equal({ '1234' => true, '4321' => true }, Facebooker::User.dashboard_multi_increment_count(['1234', '4321']))
465
+ end
466
+
467
+ def test_can_dashboard_multi_decrement_count_with_single_uid
468
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiDecrementCount', :uids => ['99999999'].to_json)
469
+ Facebooker::User.dashboard_multi_decrement_count 99999999
470
+ end
471
+
472
+ def test_can_dashboard_multi_decrement_count_with_multiple_uids
473
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiDecrementCount', :uids => ['1111', '2222'].to_json)
474
+ Facebooker::User.dashboard_multi_decrement_count 1111, 2222
475
+ end
476
+
477
+ def test_parse_dashboard_multi_decrement_count_with_array_of_uids
478
+ expect_http_posts_with_responses(dashboard_multi_decrement_count_xml)
479
+ assert_equal({ '1234' => true, '4321' => true }, Facebooker::User.dashboard_multi_decrement_count(['1234', '4321']))
480
+ end
481
+ # Dashboard
482
+
483
+ def test_can_get_news
484
+ @session.expects(:post).with('facebook.dashboard.getNews', {:uid => @user.uid, :news_ids => ['123']})
485
+ @user.get_news ['123']
486
+ end
487
+
488
+ def test_can_get_news
489
+ @session.expects(:post).with('facebook.dashboard.getNews', {:uid => @user.uid, :news_ids => ['123']})
490
+ @user.get_news ['123']
491
+ end
492
+
493
+ def test_parse_get_news
494
+ expect_http_posts_with_responses(get_news_xml)
495
+ assert_equal({"304847042079"=>{"fbid"=>"304847042079", "time"=>"1266020260510", "news"=>[{"action_link"=>{"href"=>"http://facebook.er/", "text"=>"I... I'm a test user"}, "message"=>"Hey, who are you?"}, {"action_link"=>{"href"=>"http://facebook.er/", "text"=>"I'm sorry"}, "message"=>"Stop using my application, nerd"}], "image"=>"http://facebook.er/icon.png"}}, @user.get_news(['304847042079']))
496
+ end
497
+
498
+ def test_can_add_news
499
+ @session.expects(:post).with('facebook.dashboard.addNews', {:news => [{:message => 'Hi user', :action_link => {:text => 'Uh hey there app', :href => 'http://facebook.er/'}}], :uid => @user.uid, :image => 'http://facebook.er/icon.png'})
500
+ @user.add_news [{ :message => 'Hi user', :action_link => { :text => "Uh hey there app", :href => 'http://facebook.er/' }}], 'http://facebook.er/icon.png'
501
+ end
502
+
503
+ def test_parse_add_news
504
+ expect_http_posts_with_responses(add_news_xml)
505
+ assert_equal("316446838026", @user.add_news([{ :message => 'Hi user', :action_link => { :text => "Uh hey there app", :href => 'http://facebook.er/' }}], 'http://facebook.er/icon.png'))
506
+ end
507
+
508
+ def test_can_clear_news
509
+ @session.expects(:post).with('facebook.dashboard.clearNews', { :uid => @user.uid, :news_ids => ['123']})
510
+ @user.clear_news '123'
511
+ end
512
+
513
+ def test_parse_clear_news
514
+ expect_http_posts_with_responses(clear_news_xml)
515
+ assert_equal({"362466171040"=>true}, @user.clear_news('362466171040'))
516
+ end
517
+
518
+ def test_can_multi_add_news
519
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiAddNews', { :uids => ['1234', '4321'], :news => [{ :message => 'Hi user', :action_link => { :text => "Uh hey there app", :href => 'http://facebook.er/' }}], :image => 'http://facebook.er/icon.png'})
520
+ Facebooker::User.multi_add_news(['1234', '4321'], [{ :message => 'Hi user', :action_link => { :text => "Uh hey there app", :href => 'http://facebook.er/' }}], 'http://facebook.er/icon.png')
521
+ end
522
+
523
+ def test_parse_multi_add_news
524
+ expect_http_posts_with_responses(multi_add_news_xml)
525
+ assert_equal({"1234"=>"319103117527", "4321"=>"313954287803"}, Facebooker::User.multi_add_news(['1234', '4321'], [{ :message => 'Hi user', :action_link => { :text => "Uh hey there app", :href => 'http://facebook.er/' }}], 'http://facebook.er/icon.png'))
526
+ end
527
+
528
+ def test_can_multi_get_news
529
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiGetNews', { :ids => {"1234"=>["319103117527"], "4321"=>["313954287803"]}.to_json})
530
+ Facebooker::User.multi_get_news({"1234"=>["319103117527"], "4321"=>["313954287803"]})
531
+ end
532
+
533
+ def test_parse_multi_get_news
534
+ expect_http_posts_with_responses(multi_get_news_xml)
535
+ assert_equal({"1234"=>{"319103117527"=>{"fbid"=>"319103117527", "time"=>"1266605866056", "news"=>[{"action_link"=>{"href"=>"http://facebook.er/", "text"=>"Uh hey there app"}, "message"=>"Hi user"}], "image"=>"http://facebook.er/icon.png"}}, "4321"=>{"313954287803"=>{"fbid"=>"313954287803", "time"=>"1266605866123", "news"=>[{"action_link"=>{"href"=>"http://facebook.er/", "text"=>"Uh hey there app"}, "message"=>"Hi user"}], "image"=>"http://facebook.er/icon.png"}}}, Facebooker::User.multi_get_news({"1234"=>["319103117527"], "4321"=>["313954287803"]}))
536
+ end
537
+
538
+ def test_can_multi_clear_news
539
+ Facebooker::Session.any_instance.expects(:post).with('facebook.dashboard.multiClearNews', { :ids => {"1234"=>["319103117527"], "4321"=>["313954287803"]}.to_json})
540
+ Facebooker::User.multi_clear_news({"1234"=>["319103117527"], "4321"=>["313954287803"]})
541
+ end
542
+
543
+ def test_parse_multi_clear_news
544
+ expect_http_posts_with_responses(multi_clear_news_xml)
545
+ assert_equal({"1234"=>{"319103117527"=>true}, "4321"=>{"313954287803"=>true}}, Facebooker::User.multi_clear_news({"1234"=>["319103117527"], "4321"=>["313954287803"]}))
546
+ end
547
+
548
+ def test_can_publish_activity
549
+ @session.expects(:post).with('facebook.dashboard.publishActivity', { :activity => { :message => '{*actor*} rolled around', :action_link => { :text => 'Roll around too', :href => 'http://facebook.er/' }}.to_json})
550
+ @user.publish_activity({ :message => '{*actor*} rolled around', :action_link => { :text => 'Roll around too', :href => 'http://facebook.er/' }})
551
+ end
552
+
553
+ def test_parse_publish_activity
554
+ expect_http_posts_with_responses(publish_activity_xml)
555
+ assert_equal('484161135393', @user.publish_activity({ :message => '{*actor*} rolled around', :action_link => { :text => 'Roll around too', :href => 'http://facebook.er/' }}))
556
+ end
557
+
558
+ def test_can_get_activity
559
+ @session.expects(:post).with('facebook.dashboard.getActivity', { :activity_ids => ['123'] })
560
+ @user.get_activity '123'
561
+ end
562
+
563
+ def test_parse_get_activity
564
+ expect_http_posts_with_responses(get_activity_xml)
565
+ assert_equal({"342454152268"=>{"fbid"=>"342454152268", "time"=>"1266607632567", "action_link"=>{"href"=>"http://facebook.er/", "text"=>"Roll around too"}, "message"=>"{*actor*} rolled around"}}, @user.get_activity('342454152268'))
566
+ end
567
+
568
+ def test_can_remove_activity
569
+ @session.expects(:post).with('facebook.dashboard.removeActivity', { :activity_ids => ['123'] })
570
+ @user.remove_activity ['123']
571
+ end
572
+
573
+ def test_parse_remove_activity
574
+ expect_http_posts_with_responses(remove_activity_xml)
575
+ assert_equal({"342454152268"=>true}, @user.remove_activity('123'))
576
+ end
577
+
578
+
579
+ private
580
+ def example_profile_photos_get_xml
581
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
582
+ <photos_get_response xmlns=\"http://api.facebook.com/1.0/\"
583
+ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
584
+ xsi:schemaLocation=\"http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd\" list=\"true\">
585
+ <photo>
586
+ <pid>34585991612804</pid>
587
+ <aid>2357384227378429949</aid>
588
+ <owner>1240077</owner>
589
+ <src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043524_2020.jpg</src>
590
+ <src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043524_2020.jpg</src_big>
591
+ <src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043524_2020.jpg</src_small>
592
+ <link>http://www.facebook.com/photo.php?pid=30043524&amp;id=8055</link>
593
+ <caption>From The Deathmatch (Trailer) (1999)</caption>
594
+ <created>1132553361</created>
595
+ </photo>
596
+ <photo>
597
+ <pid>34585991612805</pid>
598
+ <aid>2357384227378429949</aid>
599
+ <owner>1240077</owner>
600
+ <src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043525_2184.jpg</src>
601
+ <src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043525_2184.jpg</src_big>
602
+ <src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043525_2184.jpg</src_small>
603
+ <link>http://www.facebook.com/photo.php?pid=30043525&amp;id=8055</link>
604
+ <caption>Mexico City, back cover of the CYHS Student Underground 1999.</caption>
605
+ <created>1132553362</created>
606
+ </photo>
607
+ </photos_get_response>"
608
+ end
609
+
610
+ def example_events_get_xml
611
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
612
+ <events_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\">
613
+ <event>
614
+ <eid>29511517904</eid>
615
+ <name>PUMA SALE</name>
616
+ <tagline/>
617
+ <nid>0</nid>
618
+ <pic>http://profile.ak.facebook.com/object3/370/66/s29511517904_6952.jpg</pic>
619
+ <pic_big>http://profile.ak.facebook.com/object3/370/66/n29511517904_6952.jpg</pic_big>
620
+ <pic_small>http://profile.ak.facebook.com/object3/370/66/t29511517904_6952.jpg</pic_small>
621
+ <host>PUMA</host>
622
+ <description>PUMA SALE</description>
623
+ <event_type>Education</event_type>
624
+ <event_subtype>Study Group</event_subtype>
625
+ <start_time>1212166800</start_time>
626
+ <end_time>1212364800</end_time>
627
+ <creator>1234261165</creator>
628
+ <update_time>1209768148</update_time>
629
+ <location>PUMA LOT</location>
630
+ <venue>
631
+ <street>5 LYBERTY WAY</street>
632
+ <city>Westford</city>
633
+ <state>Massachusetts</state>
634
+ <country>United States</country>
635
+ <latitude>42.5792</latitude>
636
+ <longitude>-71.4383</longitude>
637
+ </venue>
638
+ </event>
639
+ </events_get_response>"
640
+ end
641
+
642
+ def example_users_get_info_xml
643
+ <<-XML
644
+ <?xml version="1.0" encoding="UTF-8"?> <users_getInfo_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"> <user> <uid>8055</uid> <about_me>This field perpetuates the glorification of the ego. Also, it has a character limit.</about_me> <activities>Here: facebook, etc. There: Glee Club, a capella, teaching.</activities> <affiliations list="true"> <affiliation> <nid>50453093</nid> <name>Facebook Developers</name> <type>work</type> <status/> <year/> </affiliation> </affiliations> <birthday>November 3</birthday> <books>The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar</books> <current_location> <city>Palo Alto</city> <state>CA</state> <country>United States</country> <zip>94303</zip> </current_location> <education_history list="true"> <education_info> <name>Harvard</name> <year>2003</year> <concentrations list="true"> <concentration>Applied Mathematics</concentration> <concentration>Computer Science</concentration> </concentrations> </education_info> </education_history> <first_name>Dave</first_name> <hometown_location> <city>York</city> <state>PA</state> <country>United States</country> </hometown_location> <hs_info> <hs1_name>Central York High School</hs1_name> <hs2_name/> <grad_year>1999</grad_year> <hs1_id>21846</hs1_id> <hs2_id>0</hs2_id> </hs_info> <is_app_user>1</is_app_user> <has_added_app>1</has_added_app> <interests>coffee, computers, the funny, architecture, code breaking,snowboarding, philosophy, soccer, talking to strangers</interests> <last_name>Fetterman</last_name> <locale>en_US</locale> <meeting_for list="true"> <seeking>Friendship</seeking> </meeting_for> <meeting_sex list="true"> <sex>female</sex> </meeting_sex> <movies>Tommy Boy, Billy Madison, Fight Club, Dirty Work, Meet the Parents, My Blue Heaven, Office Space </movies> <music>New Found Glory, Daft Punk, Weezer, The Crystal Method, Rage, the KLF, Green Day, Live, Coldplay, Panic at the Disco, Family Force 5</music> <name>Dave Fetterman</name> <notes_count>0</notes_count> <pic>http://photos-055.facebook.com/ip007/profile3/1271/65/s8055_39735.jpg</pic> <pic_big>http://photos-055.facebook.com/ip007/profile3/1271/65/n8055_39735.jpg</pic_big> <pic_small>http://photos-055.facebook.com/ip007/profile3/1271/65/t8055_39735.jpg</pic_small> <pic_square>http://photos-055.facebook.com/ip007/profile3/1271/65/q8055_39735.jpg</pic_square> <political>Moderate</political> <profile_update_time>1170414620</profile_update_time> <profile_url>http://www.facebook.com/profile.php?id=8055</profile_url> <quotes/> <relationship_status>In a Relationship</relationship_status> <religion/> <sex>male</sex> <significant_other_id xsi:nil="true"/> <status> <message>Fast Company, November issue, page 84</message> <time>1193075616</time> </status> <timezone>-8</timezone> <tv>cf. Bob Trahan</tv> <wall_count>121</wall_count> <work_history list="true"> <work_info> <location> <city>Palo Alto</city> <state>CA</state> <country>United States</country> </location> <company_name>Facebook</company_name> <position>Software Engineer</position> <description>Tech Lead, Facebook Platform</description> <start_date>2006-01</start_date> <end_date/> </work_info> </work_history> </user> </users_getInfo_response>
645
+ XML
646
+ end
647
+
648
+ def register_response_xml
649
+ <<-XML
650
+ <?xml version="1.0" encoding="UTF-8"?>
651
+ <connect_registerUsers_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/facebook.xsd" list="true">
652
+ <connect_registerUsers_response_elt>4228600737_c96da02bba97aedfd26136e980ae3761</connect_registerUsers_response_elt>
653
+ </connect_registerUsers_response>
654
+ XML
655
+ end
656
+
657
+ def unregister_response_xml
658
+ <<-XML
659
+ <?xml version="1.0" encoding="UTF-8"?>
660
+ <connect_unregisterUsers_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/facebook.xsd" list="true">
661
+ <connect_unregisterUsers_response_elt>4228600737_c96da02bba97aedfd26136e980ae3761</connect_unregisterUsers_response_elt>
662
+ </connect_unregisterUsers_response>
663
+ XML
664
+ end
665
+
666
+ def has_app_permission_response_xml
667
+ <<-XML
668
+ <?xml version="1.0" encoding="UTF-8"?>
669
+ <users_hasAppPermission_response xmlns="http://api.facebook.com/1.0/"
670
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
671
+ xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</users_hasAppPermission_response>
672
+ XML
673
+ end
674
+
675
+ def is_app_user_true_response_xml
676
+ <<-XML
677
+ <?xml version="1.0" encoding="UTF-8"?>
678
+ <users_isAppUser_response xmlns="http://api.facebook.com/1.0/"
679
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
680
+ xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</users_isAppUser_response>
681
+ XML
682
+ end
683
+
684
+ def is_app_user_false_response_xml
685
+ <<-XML
686
+ <?xml version="1.0" encoding="UTF-8"?>
687
+ <users_isAppUser_response xmlns="http://api.facebook.com/1.0/"
688
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
689
+ xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">0</users_isAppUser_response>
690
+ XML
691
+ end
692
+
693
+ def example_profile_publish_to_get_xml
694
+ <<-eoxml
695
+ <?xml version="1.0" encoding="UTF-8"?>
696
+ <stream_publish_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">703826862_78463536862</stream_publish_response>
697
+ eoxml
698
+ end
699
+
700
+ def example_comment_on_response
701
+ <<-eoxml
702
+ <?xml version="1.0" encoding="UTF-8"?>
703
+ <stream_addComment_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">703826862_78463536863</stream_addComment_response>
704
+ eoxml
705
+ end
706
+
707
+ def example_add_comment_response
708
+ <<-eoxml
709
+ <?xml version="1.0" encoding="UTF-8"?>
710
+ <comments_add_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">403917</comments_add_response>
711
+ eoxml
712
+ end
713
+
714
+ def example_add_like_on_response
715
+ <<-eoxml
716
+ <?xml version="1.0" encoding="UTF-8"?>
717
+ <stream_addLike_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">1</stream_addLike_response>
718
+ eoxml
719
+ end
720
+
721
+ def example_remove_like_on_response
722
+ <<-eoxml
723
+ <?xml version="1.0" encoding="UTF-8"?>
724
+ <stream_removeLike_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">1</stream_removeLike_response>
725
+ eoxml
726
+ end
727
+
728
+ def example_events_rsvp_xml
729
+ <<-E
730
+ <?xml version="1.0" encoding="UTF-8"?>
731
+ <events_rsvp_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
732
+ xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1
733
+ </events_rsvp_response>
734
+ E
735
+ end
736
+
737
+ def example_threads
738
+ <<-XML
739
+ <message_getThreadsInFolder_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">
740
+ <thread>
741
+ <thread_id>1344434538976</thread_id>
742
+ <subject>Test attachments</subject>
743
+ <recipients list="true">
744
+ <uid>1410850842</uid>
745
+ <uid>662074872</uid>
746
+ </recipients>
747
+ <updated_time>1265723631</updated_time>
748
+ <parent_message_id>0</parent_message_id>
749
+ <parent_thread_id>0</parent_thread_id>
750
+ <message_count>3</message_count>
751
+ <snippet>one link attachment to a youtube video</snippet>
752
+ <snippet_author>1410850842</snippet_author>
753
+ <object_id>0</object_id>
754
+ <unread>0</unread>
755
+ <messages list="true">
756
+ <message>
757
+ <message_id>1344434538976_0</message_id>
758
+ <author_id>662074872</author_id>
759
+ <body>one photo attachment , 4KB jpeg image</body>
760
+ <created_time>1265723631</created_time>
761
+ <attachment>
762
+ <media list="true"/>
763
+ <href>http://www.facebook.com/photo.php?pid=3358326&amp;id=662074872</href>
764
+ <properties list="true"/>
765
+ <icon>http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif</icon>
766
+ <fb_object_type/>
767
+ <fb_object_id/>
768
+ <tagged_ids list="true"/>
769
+ </attachment>
770
+ <thread_id>1344434538976</thread_id>
771
+ </message>
772
+ <message>
773
+ <message_id>1344434538976_1</message_id>
774
+ <author_id>1410850842</author_id>
775
+ <body>one link attachment (http://www.facebook.com/l/e46dd;google.fr)</body>
776
+ <created_time>1265723941</created_time>
777
+ <attachment>
778
+ <media list="true">
779
+ <stream_media>
780
+ <href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.google.fr%252F&amp;h=e46dd63cdbfadb74958fbe44e98f339c</href>
781
+ <type>link</type>
782
+ <src>http://external.ak.fbcdn.net/safe_image.php?d=dd54bba6b6e6479a89bb8084573c02c8&amp;w=90&amp;h=90&amp;url=http%3A%2F%2Fwww.google.fr%2Fintl%2Ffr_fr%2Fimages%2Flogo.gif</src>
783
+ </stream_media>
784
+ </media>
785
+ <name>Google</name>
786
+ <href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.google.fr%252F&amp;h=e46dd63cdbfadb74958fbe44e98f339c</href>
787
+ <caption>www.google.fr</caption>
788
+ <properties list="true"/>
789
+ <icon>http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif</icon>
790
+ <fb_object_type/>
791
+ <fb_object_id/>
792
+ <tagged_ids list="true"/>
793
+ </attachment>
794
+ <thread_id>1344434538976</thread_id>
795
+ </message>
796
+ <message>
797
+ <message_id>1344434538976_2</message_id>
798
+ <author_id>1410850842</author_id>
799
+ <body>one link attachment to a youtube video</body>
800
+ <created_time>1265726503</created_time>
801
+ <attachment>
802
+ <media list="true">
803
+ <stream_media>
804
+ <href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DAW-sNQUmUIM%2526feature%253Dpopular&amp;h=e46dd63cdbfadb74958fbe44e98f339c</href>
805
+ <alt>super bowl 44 highlights saints vs colts</alt>
806
+ <type>video</type>
807
+ <src>http://external.ak.fbcdn.net/safe_image.php?d=66f4aa965e2ae4a20a11c6a8ae3e4b1b&amp;w=90&amp;h=90&amp;url=http%3A%2F%2Fi.ytimg.com%2Fvi%2FAW-sNQUmUIM%2F2.jpg</src>
808
+ <video>
809
+ <display_url>http://www.youtube.com/watch?v=AW-sNQUmUIM&amp;feature=popular</display_url>
810
+ <source_url>http://www.youtube.com/v/AW-sNQUmUIM&amp;autoplay=1</source_url>
811
+ <owner>1410850842</owner>
812
+ <source_type>html</source_type>
813
+ </video>
814
+ </stream_media>
815
+ </media>
816
+ <name>super bowl 44 highlights saints vs colts</name>
817
+ <href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253DAW-sNQUmUIM%2526feature%253Dpopular&amp;h=e46dd63cdbfadb74958fbe44e98f339c</href>
818
+ <caption>www.youtube.com</caption>
819
+ <description>NFL super bowl 44 highlights saints vs colts from south florida.</description>
820
+ <properties list="true"/>
821
+ <icon>http://static.ak.fbcdn.net/rsrc.php/z9XZ8/hash/976ulj6z.gif</icon>
822
+ <fb_object_type/>
823
+ <fb_object_id/>
824
+ <tagged_ids list="true"/>
825
+ </attachment>
826
+ <thread_id>1344434538976</thread_id>
827
+ </message>
828
+ </messages>
829
+ </thread>
830
+ <thread>
831
+ <thread_id>1012985167472</thread_id>
832
+ <subject>Happy Holidays from the Facebook Platform Team</subject>
833
+ <recipients list="true">
834
+ <uid>220400</uid>
835
+ </recipients>
836
+ <updated_time>1230000685</updated_time>
837
+ <parent_message_id>0</parent_message_id>
838
+ <parent_thread_id>0</parent_thread_id>
839
+ <message_count>1</message_count>
840
+ <snippet>We wanted to take a moment and thank you for all of your great work and amazi...</snippet>
841
+ <snippet_author>220400</snippet_author>
842
+ <object_id>2205007948</object_id>
843
+ <unread>0</unread>
844
+ <messages list="true">
845
+ <message>
846
+ <message_id>1012985167472_0</message_id>
847
+ <author_id>220400</author_id>
848
+ <body>We wanted to take a moment and thank you for all of your great work and amazing applications that have helped make Facebook Platform the largest and fastest-growing social platform over the past year and a half. As we end 2008 there are over 660,000 of you worldwide building applications that give users more powerful ways to share and connect, and collectively your applications have reached nearly 140 million people.
849
+
850
+ Just recently, we've been excited to bring you Facebook Connect - allowing you to integrate the tools and features of Facebook Platform on your Websites, devices and desktop applications. In the next several months, we're looking forward to introducing additional improvements to help users more easily find your applications as well as launching the first sets of Verified Applications to users. If you haven't applied for verification yet, apply here:
851
+ http://developers.facebook.com/verification.php
852
+
853
+ Over the next year, we look forward to continued developments to improve Facebook Platform and help you reach and engage more users, and grow and sustain your business. We would love your feedback and input on what you think is most important - please take a few minutes and answer our survey here:
854
+
855
+ http://www.facebook.com/l/e46dd;https://www.questionpro.com/akira/TakeSurvey?id=1121648
856
+
857
+ From all of us at Facebook, we wish you and your families &quot;Happy Holidays,&quot; and we look forward to making the web even more social with you in 2009!</body>
858
+ <created_time>1230000042</created_time>
859
+ <attachment>
860
+ <media list="true"/>
861
+ <name>Feb 10, 2010 1:26pm</name>
862
+ <href>http://www.facebook.com/video/video.php?v=12345</href>
863
+ <properties list="true"/>
864
+ <icon>http://static.ak.fbcdn.net/rsrc.php/zB010/hash/9yvl71tw.gif</icon>
865
+ <fb_object_type/>
866
+ <fb_object_id/>
867
+ <tagged_ids list="true"/>
868
+ </attachment>
869
+ <thread_id>1012985167472</thread_id>
870
+ </message>
871
+ </messages>
872
+ </thread>
873
+ </message_getThreadsInFolder_response>
874
+ XML
875
+ end
876
+
877
+
878
+ def dashboard_get_count_xml
879
+ <<-XML
880
+ <?xml version="1.0" encoding="UTF-8"?>
881
+ <dashboard_getCount_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">12</dashboard_getCount_response>
882
+ XML
883
+ end
884
+
885
+ def dashboard_set_count_xml
886
+ <<-XML
887
+ <?xml version="1.0" encoding="UTF-8"?>
888
+ <dashboard_setCount_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">1</dashboard_setCount_response>
889
+ XML
890
+ end
891
+
892
+ def dashboard_increment_count_xml
893
+ <<-XML
894
+ <?xml version="1.0" encoding="UTF-8"?>
895
+ <dashboard_incrementCount_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">1</dashboard_incrementCount_response>
896
+ XML
897
+ end
898
+
899
+ def dashboard_decrement_count_xml
900
+ <<-XML
901
+ <?xml version="1.0" encoding="UTF-8"?>
902
+ <dashboard_decrementCount_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">1</dashboard_decrementCount_response>
903
+ XML
904
+ end
905
+
906
+ def dashboard_multi_set_count_xml
907
+ <<-XML
908
+ <?xml version="1.0" encoding="UTF-8"?>
909
+ <dashboard_multiSetCount_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">
910
+ <dashboard_multiSetCount_response_elt key="1234">1</dashboard_multiSetCount_response_elt>
911
+ <dashboard_multiSetCount_response_elt key="4321">1</dashboard_multiSetCount_response_elt>
912
+ </dashboard_multiSetCount_response>
913
+ XML
914
+ end
915
+
916
+ def dashboard_multi_get_count_xml
917
+ <<-XML
918
+ <?xml version="1.0" encoding="UTF-8"?>
919
+ <dashboard_multiGetCount_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">
920
+ <dashboard_multiGetCount_response_elt key="1234">11</dashboard_multiGetCount_response_elt>
921
+ <dashboard_multiGetCount_response_elt key="4321">22</dashboard_multiGetCount_response_elt>
922
+ </dashboard_multiGetCount_response>
923
+ XML
924
+ end
925
+
926
+ def dashboard_multi_increment_count_xml
927
+ <<-XML
928
+ <?xml version="1.0" encoding="UTF-8"?>
929
+ <dashboard_multiIncrementCount_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">
930
+ <dashboard_multiIncrementCount_response_elt key="1234">1</dashboard_multiIncrementCount_response_elt>
931
+ <dashboard_multiIncrementCount_response_elt key="4321">1</dashboard_multiIncrementCount_response_elt>
932
+ </dashboard_multiIncrementCount_response>
933
+ XML
934
+ end
935
+
936
+ def dashboard_multi_decrement_count_xml
937
+ <<-XML
938
+ <?xml version="1.0" encoding="UTF-8"?>
939
+ <dashboard_multiDecrementCount_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">
940
+ <dashboard_multiDecrementCount_response_elt key="1234">1</dashboard_multiDecrementCount_response_elt>
941
+ <dashboard_multiDecrementCount_response_elt key="4321">1</dashboard_multiDecrementCount_response_elt>
942
+ </dashboard_multiDecrementCount_response>
943
+ XML
944
+ end
945
+
946
+ def get_news_xml
947
+ <<-XML
948
+ <?xml version="1.0" encoding="UTF-8"?>
949
+ <dashboard_getNews_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">
950
+ <dashboard_getNews_response_elt key="304847042079" list="true">
951
+ <dashboard_getNews_response_elt_elt key="image">http://facebook.er/icon.png</dashboard_getNews_response_elt_elt>
952
+ <dashboard_getNews_response_elt_elt key="news" list="true">
953
+ <dashboard_getNews_response_elt_elt_elt list="true">
954
+ <dashboard_getNews_response_elt_elt_elt_elt key="action_link" list="true">
955
+ <dashboard_getNews_response_elt_elt_elt_elt_elt key="href">http://facebook.er/</dashboard_getNews_response_elt_elt_elt_elt_elt>
956
+ <dashboard_getNews_response_elt_elt_elt_elt_elt key="text">I... I'm a test user</dashboard_getNews_response_elt_elt_elt_elt_elt>
957
+ </dashboard_getNews_response_elt_elt_elt_elt>
958
+ <dashboard_getNews_response_elt_elt_elt_elt key="message">Hey, who are you?</dashboard_getNews_response_elt_elt_elt_elt>
959
+ </dashboard_getNews_response_elt_elt_elt>
960
+ <dashboard_getNews_response_elt_elt_elt list="true">
961
+ <dashboard_getNews_response_elt_elt_elt_elt key="action_link" list="true">
962
+ <dashboard_getNews_response_elt_elt_elt_elt_elt key="href">http://facebook.er/</dashboard_getNews_response_elt_elt_elt_elt_elt>
963
+ <dashboard_getNews_response_elt_elt_elt_elt_elt key="text">I'm sorry</dashboard_getNews_response_elt_elt_elt_elt_elt>
964
+ </dashboard_getNews_response_elt_elt_elt_elt>
965
+ <dashboard_getNews_response_elt_elt_elt_elt key="message">Stop using my application, nerd</dashboard_getNews_response_elt_elt_elt_elt>
966
+ </dashboard_getNews_response_elt_elt_elt>
967
+ </dashboard_getNews_response_elt_elt>
968
+ <dashboard_getNews_response_elt_elt key="time">1266020260510</dashboard_getNews_response_elt_elt>
969
+ <dashboard_getNews_response_elt_elt key="fbid">304847042079</dashboard_getNews_response_elt_elt>
970
+ </dashboard_getNews_response_elt>
971
+ </dashboard_getNews_response>
972
+ XML
973
+ end
974
+
975
+ def add_news_xml
976
+ <<-XML
977
+ <?xml version="1.0" encoding="UTF-8"?>
978
+ <dashboard_addNews_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">316446838026</dashboard_addNews_response>
979
+ XML
980
+ end
981
+
982
+ def clear_news_xml
983
+ <<-XML
984
+ <?xml version="1.0" encoding="UTF-8"?>
985
+ <dashboard_clearNews_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">
986
+ <dashboard_clearNews_response_elt key="362466171040">1</dashboard_clearNews_response_elt>
987
+ </dashboard_clearNews_response>
988
+ XML
989
+ end
990
+
991
+ def multi_add_news_xml
992
+ <<-XML
993
+ <?xml version="1.0" encoding="UTF-8"?>
994
+ <dashboard_multiAddNews_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">
995
+ <dashboard_multiAddNews_response_elt key="1234">319103117527</dashboard_multiAddNews_response_elt>
996
+ <dashboard_multiAddNews_response_elt key="4321">313954287803</dashboard_multiAddNews_response_elt>
997
+ </dashboard_multiAddNews_response>
998
+ XML
999
+ end
1000
+
1001
+ def multi_get_news_xml
1002
+ <<-XML
1003
+ <?xml version="1.0" encoding="UTF-8"?>
1004
+ <dashboard_multiGetNews_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">
1005
+ <dashboard_multiGetNews_response_elt key="1234" list="true">
1006
+ <dashboard_multiGetNews_response_elt_elt key="319103117527" list="true">
1007
+ <dashboard_multiGetNews_response_elt_elt_elt key="image">http://facebook.er/icon.png</dashboard_multiGetNews_response_elt_elt_elt>
1008
+ <dashboard_multiGetNews_response_elt_elt_elt key="news" list="true">
1009
+ <dashboard_multiGetNews_response_elt_elt_elt_elt list="true">
1010
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt key="message">Hi user</dashboard_multiGetNews_response_elt_elt_elt_elt_elt>
1011
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt key="action_link" list="true">
1012
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt key="href">http://facebook.er/</dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt>
1013
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt key="text">Uh hey there app</dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt>
1014
+ </dashboard_multiGetNews_response_elt_elt_elt_elt_elt>
1015
+ </dashboard_multiGetNews_response_elt_elt_elt_elt>
1016
+ </dashboard_multiGetNews_response_elt_elt_elt>
1017
+ <dashboard_multiGetNews_response_elt_elt_elt key="time">1266605866056</dashboard_multiGetNews_response_elt_elt_elt>
1018
+ <dashboard_multiGetNews_response_elt_elt_elt key="fbid">319103117527</dashboard_multiGetNews_response_elt_elt_elt>
1019
+ </dashboard_multiGetNews_response_elt_elt>
1020
+ </dashboard_multiGetNews_response_elt>
1021
+ <dashboard_multiGetNews_response_elt key="4321" list="true">
1022
+ <dashboard_multiGetNews_response_elt_elt key="313954287803" list="true">
1023
+ <dashboard_multiGetNews_response_elt_elt_elt key="image">http://facebook.er/icon.png</dashboard_multiGetNews_response_elt_elt_elt>
1024
+ <dashboard_multiGetNews_response_elt_elt_elt key="news" list="true">
1025
+ <dashboard_multiGetNews_response_elt_elt_elt_elt list="true">
1026
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt key="message">Hi user</dashboard_multiGetNews_response_elt_elt_elt_elt_elt>
1027
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt key="action_link" list="true">
1028
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt key="href">http://facebook.er/</dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt>
1029
+ <dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt key="text">Uh hey there app</dashboard_multiGetNews_response_elt_elt_elt_elt_elt_elt>
1030
+ </dashboard_multiGetNews_response_elt_elt_elt_elt_elt>
1031
+ </dashboard_multiGetNews_response_elt_elt_elt_elt>
1032
+ </dashboard_multiGetNews_response_elt_elt_elt>
1033
+ <dashboard_multiGetNews_response_elt_elt_elt key="time">1266605866123</dashboard_multiGetNews_response_elt_elt_elt>
1034
+ <dashboard_multiGetNews_response_elt_elt_elt key="fbid">313954287803</dashboard_multiGetNews_response_elt_elt_elt>
1035
+ </dashboard_multiGetNews_response_elt_elt>
1036
+ </dashboard_multiGetNews_response_elt>
1037
+ </dashboard_multiGetNews_response>
1038
+ XML
1039
+ end
1040
+
1041
+ def multi_clear_news_xml
1042
+ <<-XML
1043
+ <?xml version="1.0" encoding="UTF-8"?><dashboard_multiClearNews_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">
1044
+ <dashboard_multiClearNews_response_elt key="1234" list="true">
1045
+ <dashboard_multiClearNews_response_elt_elt key="319103117527">1</dashboard_multiClearNews_response_elt_elt>
1046
+ </dashboard_multiClearNews_response_elt>
1047
+ <dashboard_multiClearNews_response_elt key="4321" list="true">
1048
+ <dashboard_multiClearNews_response_elt_elt key="313954287803">1</dashboard_multiClearNews_response_elt_elt>
1049
+ </dashboard_multiClearNews_response_elt>
1050
+ </dashboard_multiClearNews_response>
1051
+ XML
1052
+ end
1053
+
1054
+ def publish_activity_xml
1055
+ <<-XML
1056
+ <?xml version="1.0" encoding="UTF-8"?>
1057
+ <dashboard_publishActivity_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">484161135393</dashboard_publishActivity_response>
1058
+ XML
1059
+ end
1060
+
1061
+ def get_activity_xml
1062
+ <<-XML
1063
+ <?xml version="1.0" encoding="UTF-8"?>
1064
+ <dashboard_getActivity_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">
1065
+ <dashboard_getActivity_response_elt key="342454152268" list="true">
1066
+ <dashboard_getActivity_response_elt_elt key="message">{*actor*} rolled around</dashboard_getActivity_response_elt_elt>
1067
+ <dashboard_getActivity_response_elt_elt key="action_link" list="true">
1068
+ <dashboard_getActivity_response_elt_elt_elt key="href">http://facebook.er/</dashboard_getActivity_response_elt_elt_elt>
1069
+ <dashboard_getActivity_response_elt_elt_elt key="text">Roll around too</dashboard_getActivity_response_elt_elt_elt>
1070
+ </dashboard_getActivity_response_elt_elt>
1071
+ <dashboard_getActivity_response_elt_elt key="time">1266607632567</dashboard_getActivity_response_elt_elt>
1072
+ <dashboard_getActivity_response_elt_elt key="fbid">342454152268</dashboard_getActivity_response_elt_elt>
1073
+ </dashboard_getActivity_response_elt>
1074
+ </dashboard_getActivity_response>
1075
+ XML
1076
+ end
1077
+
1078
+ def remove_activity_xml
1079
+ <<-XML
1080
+ <?xml version="1.0" encoding="UTF-8"?>
1081
+ <dashboard_removeActivity_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">
1082
+ <dashboard_removeActivity_response_elt key="342454152268">1</dashboard_removeActivity_response_elt>
1083
+ </dashboard_removeActivity_response>
1084
+ XML
1085
+ end
1086
+
1087
+ end