facebooker-lite 1.0.67
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +15 -0
- data/CHANGELOG.rdoc +24 -0
- data/COPYING.rdoc +19 -0
- data/Manifest.txt +114 -0
- data/README.rdoc +120 -0
- data/Rakefile +94 -0
- data/TODO.rdoc +4 -0
- data/facebooker.gemspec +42 -0
- data/generators/xd_receiver/templates/xd_receiver.html +10 -0
- data/generators/xd_receiver/templates/xd_receiver_ssl.html +10 -0
- data/generators/xd_receiver/xd_receiver_generator.rb +10 -0
- data/init.rb +25 -0
- data/install.rb +12 -0
- data/lib/facebooker.rb +261 -0
- data/lib/facebooker/adapters/adapter_base.rb +91 -0
- data/lib/facebooker/adapters/bebo_adapter.rb +77 -0
- data/lib/facebooker/adapters/facebook_adapter.rb +60 -0
- data/lib/facebooker/admin.rb +42 -0
- data/lib/facebooker/application.rb +37 -0
- data/lib/facebooker/attachment.rb +51 -0
- data/lib/facebooker/batch_request.rb +45 -0
- data/lib/facebooker/data.rb +57 -0
- data/lib/facebooker/feed.rb +78 -0
- data/lib/facebooker/logging.rb +44 -0
- data/lib/facebooker/mobile.rb +20 -0
- data/lib/facebooker/mock/service.rb +50 -0
- data/lib/facebooker/mock/session.rb +18 -0
- data/lib/facebooker/model.rb +139 -0
- data/lib/facebooker/models/affiliation.rb +10 -0
- data/lib/facebooker/models/album.rb +11 -0
- data/lib/facebooker/models/applicationproperties.rb +39 -0
- data/lib/facebooker/models/applicationrestrictions.rb +10 -0
- data/lib/facebooker/models/comment.rb +9 -0
- data/lib/facebooker/models/cookie.rb +10 -0
- data/lib/facebooker/models/education_info.rb +11 -0
- data/lib/facebooker/models/event.rb +28 -0
- data/lib/facebooker/models/family_relative_info.rb +7 -0
- data/lib/facebooker/models/friend_list.rb +16 -0
- data/lib/facebooker/models/group.rb +36 -0
- data/lib/facebooker/models/info_item.rb +10 -0
- data/lib/facebooker/models/info_section.rb +10 -0
- data/lib/facebooker/models/location.rb +8 -0
- data/lib/facebooker/models/message_thread.rb +89 -0
- data/lib/facebooker/models/notifications.rb +17 -0
- data/lib/facebooker/models/page.rb +46 -0
- data/lib/facebooker/models/photo.rb +19 -0
- data/lib/facebooker/models/tag.rb +12 -0
- data/lib/facebooker/models/user.rb +751 -0
- data/lib/facebooker/models/video.rb +9 -0
- data/lib/facebooker/models/work_info.rb +10 -0
- data/lib/facebooker/parser.rb +970 -0
- data/lib/facebooker/rails/backwards_compatible_param_checks.rb +31 -0
- data/lib/facebooker/rails/controller.rb +353 -0
- data/lib/facebooker/rails/extensions/action_controller.rb +47 -0
- data/lib/facebooker/rails/extensions/rack_setup.rb +16 -0
- data/lib/facebooker/rails/extensions/routing.rb +15 -0
- data/lib/facebooker/rails/facebook_pretty_errors.rb +22 -0
- data/lib/facebooker/rails/facebook_request_fix.rb +28 -0
- data/lib/facebooker/rails/facebook_request_fix_2-3.rb +31 -0
- data/lib/facebooker/rails/facebook_session_handling.rb +68 -0
- data/lib/facebooker/rails/facebook_url_rewriting.rb +60 -0
- data/lib/facebooker/rails/helpers/fb_connect.rb +75 -0
- data/lib/facebooker/rails/integration_session.rb +38 -0
- data/lib/facebooker/rails/profile_publisher_extensions.rb +42 -0
- data/lib/facebooker/rails/publisher.rb +608 -0
- data/lib/facebooker/rails/routing.rb +49 -0
- data/lib/facebooker/rails/test_helpers.rb +68 -0
- data/lib/facebooker/rails/utilities.rb +22 -0
- data/lib/facebooker/server_cache.rb +24 -0
- data/lib/facebooker/service.rb +103 -0
- data/lib/facebooker/service/base_service.rb +19 -0
- data/lib/facebooker/service/curl_service.rb +44 -0
- data/lib/facebooker/service/net_http_service.rb +12 -0
- data/lib/facebooker/service/typhoeus_multi_service.rb +27 -0
- data/lib/facebooker/service/typhoeus_service.rb +17 -0
- data/lib/facebooker/session.rb +786 -0
- data/lib/facebooker/stream_post.rb +19 -0
- data/lib/facebooker/version.rb +9 -0
- data/lib/net/http_multipart_post.rb +123 -0
- data/lib/rack/facebook.rb +89 -0
- data/lib/rack/facebook_session.rb +21 -0
- data/lib/tasks/facebooker.rake +19 -0
- data/lib/tasks/facebooker.rb +2 -0
- data/lib/tasks/tunnel.rake +46 -0
- data/rails/init.rb +1 -0
- data/setup.rb +1585 -0
- data/templates/layout.erb +24 -0
- data/test/facebooker/adapters_test.rb +191 -0
- data/test/facebooker/admin_test.rb +102 -0
- data/test/facebooker/application_test.rb +110 -0
- data/test/facebooker/attachment_test.rb +72 -0
- data/test/facebooker/batch_request_test.rb +83 -0
- data/test/facebooker/data_test.rb +86 -0
- data/test/facebooker/logging_test.rb +43 -0
- data/test/facebooker/mobile_test.rb +45 -0
- data/test/facebooker/model_test.rb +133 -0
- data/test/facebooker/models/event_test.rb +15 -0
- data/test/facebooker/models/page_test.rb +56 -0
- data/test/facebooker/models/photo_test.rb +16 -0
- data/test/facebooker/models/user_test.rb +1074 -0
- data/test/facebooker/rails/facebook_request_fix_2-3_test.rb +25 -0
- data/test/facebooker/rails/facebook_url_rewriting_test.rb +76 -0
- data/test/facebooker/rails/integration_session_test.rb +13 -0
- data/test/facebooker/rails/publisher_test.rb +538 -0
- data/test/facebooker/rails_integration_test.rb +1543 -0
- data/test/facebooker/server_cache_test.rb +44 -0
- data/test/facebooker/service_test.rb +58 -0
- data/test/facebooker/session_test.rb +883 -0
- data/test/facebooker_test.rb +1263 -0
- data/test/fixtures/multipart_post_body_with_only_parameters.txt +33 -0
- data/test/fixtures/multipart_post_body_with_single_file.txt +38 -0
- data/test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt +38 -0
- data/test/net/http_multipart_post_test.rb +52 -0
- data/test/rack/facebook_session_test.rb +34 -0
- data/test/rack/facebook_test.rb +73 -0
- data/test/rails_test_helper.rb +36 -0
- data/test/test_helper.rb +74 -0
- metadata +278 -0
@@ -0,0 +1,1263 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
2
|
+
require 'net/http_multipart_post'
|
3
|
+
class TestFacebooker < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@api_key = "95a71599e8293s66f1f0a6f4aeab3df7"
|
7
|
+
@secret_key = "3e4du8eea435d8e205a6c9b5d095bed1"
|
8
|
+
ENV["FACEBOOK_API_KEY"] = @api_key
|
9
|
+
ENV["FACEBOOK_SECRET_KEY"] = @secret_key
|
10
|
+
@session = Facebooker::Session.create(@api_key, @secret_key)
|
11
|
+
@desktop_session = Facebooker::Session::Desktop.create(@api_key, @secret_key)
|
12
|
+
@service = Facebooker::Service.new('http://apibase.com', '/api/path', @api_key)
|
13
|
+
@desktop_session.instance_variable_set("@service", @service)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_asset_host_callback_url
|
17
|
+
Facebooker.set_asset_host_to_callback_url = true
|
18
|
+
assert_equal true, Facebooker.set_asset_host_to_callback_url
|
19
|
+
|
20
|
+
Facebooker.set_asset_host_to_callback_url = false
|
21
|
+
assert_equal false, Facebooker.set_asset_host_to_callback_url
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_session_must_be_created_from_api_key_and_secret_key
|
25
|
+
assert_kind_of(Facebooker::Session, @session)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_session_can_tell_you_its_login_url
|
29
|
+
assert_not_nil(@session.login_url)
|
30
|
+
assert_equal("http://www.facebook.com/login.php?api_key=#{@api_key}&v=1.0", @session.login_url)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_desktop_session_returns_auth_toke_as_part_of_login_url
|
34
|
+
@service = flexmock(@service).should_receive(:post).at_least.once.and_return(123)
|
35
|
+
assert_kind_of(Facebooker::Session::Desktop, @desktop_session)
|
36
|
+
assert_match(/auth_token=[a-z0-9A-Z]/, @desktop_session.login_url)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_service_posts_data_to_http_location
|
40
|
+
flexmock(Net::HTTP).should_receive(:post_form).and_return(example_auth_token_xml)
|
41
|
+
assert_equal("http://www.facebook.com/login.php?api_key=#{@api_key}&v=1.0&auth_token=3e4a22bb2f5ed75114b0fc9995ea85f1", @desktop_session.login_url)
|
42
|
+
end
|
43
|
+
|
44
|
+
# def test_serivce_post_file_delegates_to_post_multipart_form
|
45
|
+
# # flexmock(@service).should_receive(:url).and_return('url')
|
46
|
+
# # flexmock(Net::HTTP).expects(:post_multipart_form).with('url', {:method => 'facebook.auth.createToken'}).returns(example_auth_token_xml)
|
47
|
+
#
|
48
|
+
# res = mock(:content_type => 'text/html', :code => '200', :body => '<html><body>my blog</body></html>')
|
49
|
+
# Net::HTTP.stubs(:get_response).once.with(uri).returns res
|
50
|
+
#
|
51
|
+
# @service.post_file(:method => 'facebook.auth.createToken')
|
52
|
+
# end
|
53
|
+
|
54
|
+
def test_desktop_session_be_secured_and_activated_after_receiving_auth_token_and_logging_in
|
55
|
+
establish_session
|
56
|
+
assert_equal("5f34e11bfb97c762e439e6a5-8055", @session.instance_variable_get("@session_key"))
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_desktop_session_uses_secret_api_key_for_hashing_until_user_authenticates
|
60
|
+
assert_equal(@secret_key, @desktop_session.secret_for_method('facebook.auth.createToken'))
|
61
|
+
establish_session(@desktop_session)
|
62
|
+
assert_equal("ohairoflamao12345", @desktop_session.secret_for_method('anyNonAuthMethodName'))
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_session_can_get_current_logged_in_user_id_and_will_cache
|
66
|
+
establish_session
|
67
|
+
flexmock(Net::HTTP).should_receive(:post_form).and_return(example_get_logged_in_user_xml)
|
68
|
+
assert_equal(8055, @session.user.id)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_can_get_current_users_friends
|
72
|
+
expect_http_posts_with_responses(example_friends_xml)
|
73
|
+
assert_equal([222333, 1240079], @session.user.friends.map{|friend| friend.id})
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_can_get_current_users_friend_lists
|
77
|
+
expect_http_posts_with_responses(example_friend_lists_xml)
|
78
|
+
assert_equal([12089150545, 16361710545], @session.user.friend_lists.map{|friend_list| friend_list.flid})
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_can_get_info_for_instance_of_user
|
82
|
+
populate_user_info
|
83
|
+
@session.user.first_name = "Dave"
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_can_get_info_for_one_or_more_users
|
87
|
+
friends = populate_session_friends
|
88
|
+
friend = friends.detect{|f| f.id == 222333}
|
89
|
+
assert_equal('This field perpetuates the glorification of the ego. Also, it has a character limit.',
|
90
|
+
friend.about_me)
|
91
|
+
assert_equal('Facebook Developers', friend.affiliations.first.name)
|
92
|
+
assert_equal('Friendship', friend.meeting_for.first)
|
93
|
+
assert_equal('94303', friend.current_location.zip)
|
94
|
+
assert_equal('York', friend.hometown_location.city)
|
95
|
+
assert_equal('Harvard', friend.education_history.first.name)
|
96
|
+
assert(friend.education_history.first.concentrations.include?("Computer Science"))
|
97
|
+
assert_equal('Central York High School', friend.hs_info.hs1_name)
|
98
|
+
assert_equal('female', friend.meeting_sex.first)
|
99
|
+
assert_equal('I rule', friend.status.message)
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_can_get_specific_info_for_one_or_more_users
|
103
|
+
friends = populate_session_friends_with_limited_fields
|
104
|
+
friend = friends.detect{|f| f.id == 222333}
|
105
|
+
assert_equal('I rule', friend.status.message)
|
106
|
+
assert_equal(nil, friend.hometown_location)
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_can_handle_nil_data
|
110
|
+
friends = populate_session_friends_with_nil_data
|
111
|
+
friend = friends.detect{|f| f.id == 222333}
|
112
|
+
assert_equal(nil,friend.current_location)
|
113
|
+
assert_equal(nil,friend.pic)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_session_can_expire_on_server_and_client_handles_appropriately
|
117
|
+
expect_http_posts_with_responses(example_session_expired_error_response)
|
118
|
+
assert_raises(Facebooker::Session::SessionExpired) {
|
119
|
+
@session.user.friends
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
def test_can_publish_story_to_users_feed
|
125
|
+
expect_http_posts_with_responses(example_publish_story_xml)
|
126
|
+
assert_nothing_raised {
|
127
|
+
assert(@session.user.publish_story((s = Facebooker::Feed::Story.new; s.title = 'o hai'; s.body = '4srsly'; s)))
|
128
|
+
}
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
def test_can_publish_action_to_users_feed
|
133
|
+
expect_http_posts_with_responses(example_publish_action_xml)
|
134
|
+
assert_nothing_raised {
|
135
|
+
assert(@session.user.publish_action((s = Facebooker::Feed::Action.new; s.title = 'o hai'; s.body = '4srsly'; s)))
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
def test_can_publish_templatized_action_to_users_feed
|
140
|
+
expect_http_posts_with_responses(example_publish_templatized_action_xml)
|
141
|
+
assert_nothing_raised {
|
142
|
+
action = Facebooker::Feed::TemplatizedAction.new
|
143
|
+
action.title_template = "{actor} did something"
|
144
|
+
assert(@session.user.publish_templatized_action(action))
|
145
|
+
}
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_can_publish_templatized_action_to_users_feed_with_params_as_string
|
149
|
+
json_data="{\"move\": \"punch\"}"
|
150
|
+
action = Facebooker::Feed::TemplatizedAction.new
|
151
|
+
action.title_template = "{actor} did something "
|
152
|
+
action.title_data=json_data
|
153
|
+
assert_equal action.to_params[:title_data],json_data
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_can_publish_templatized_action_to_users_feed_with_params_as_hash
|
157
|
+
json_data="{\"move\": \"punch\"}"
|
158
|
+
hash={:move=>"punch"}
|
159
|
+
hash.expects(:to_json).returns(json_data)
|
160
|
+
action = Facebooker::Feed::TemplatizedAction.new
|
161
|
+
action.title_template = "{actor} did something "
|
162
|
+
action.title_data=hash
|
163
|
+
assert_equal action.to_params[:title_data],json_data
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_can_deactivate_template_bundle_by_id
|
167
|
+
expect_http_posts_with_responses(example_deactivate_template_bundle_by_id_xml)
|
168
|
+
assert_equal true, @session.post('facebook.feed.deactivateTemplateBundleByID', :template_bundle_id => 123)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_can_get_notifications_for_logged_in_user
|
172
|
+
expect_http_posts_with_responses(example_notifications_get_xml)
|
173
|
+
assert_equal("1", @session.user.notifications.messages.unread)
|
174
|
+
assert_equal("0", @session.user.notifications.pokes.unread)
|
175
|
+
assert_equal("1", @session.user.notifications.shares.unread)
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_can_send_notifications
|
179
|
+
expect_http_posts_with_responses(example_notifications_send_xml)
|
180
|
+
assert_nothing_raised {
|
181
|
+
user_ids = [123, 321]
|
182
|
+
notification_fbml = "O HAI!!!"
|
183
|
+
optional_email_fbml = "This would be in the email. If this is not passed, facebook sends no mailz!"
|
184
|
+
assert_equal('http://www.facebook.com/send_email.php?from=211031&id=52', @session.send_notification(user_ids, notification_fbml, optional_email_fbml))
|
185
|
+
}
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_can_send_emails
|
189
|
+
expect_http_posts_with_responses(example_notifications_send_email_xml)
|
190
|
+
assert_nothing_raised {
|
191
|
+
user_ids = [123, 321]
|
192
|
+
text = "Hi I am the text part of the email."
|
193
|
+
fbml = "Hi I am the fbml version of the <b>email</a>"
|
194
|
+
subject = "Somethign you should really pay attention to."
|
195
|
+
assert_equal('123,321', @session.send_email(user_ids, subject,text,fbml ))
|
196
|
+
}
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_can_find_friends_who_have_installed_app
|
200
|
+
expect_http_posts_with_responses(example_app_users_xml)
|
201
|
+
assert_equal(2, @session.user.friends_with_this_app.size)
|
202
|
+
assert_equal([222333, 1240079], @session.user.friends_with_this_app.map{|f| f.id})
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_when_marshaling_a_session_object_only_enough_data_to_stay_authenticated_is_stored
|
206
|
+
populate_session_friends
|
207
|
+
assert_equal(2, @session.user.friends.size)
|
208
|
+
reloaded_session = Marshal.load(Marshal.dump(@session))
|
209
|
+
%w(@session_key @uid @expires @secret_from_session @auth_token).each do |iv_name|
|
210
|
+
assert_not_nil(reloaded_session.instance_variable_get(iv_name))
|
211
|
+
end
|
212
|
+
assert_nil(reloaded_session.user.instance_variable_get("@friends"))
|
213
|
+
end
|
214
|
+
|
215
|
+
def test_sessions_can_be_infinite_or_can_expire
|
216
|
+
establish_session
|
217
|
+
assert(@session.expired?, "Session with expiry time #{@session.instance_variable_get('@expires')} occurred in the past and should be expired.")
|
218
|
+
@session.instance_variable_set("@expires", 0)
|
219
|
+
assert(@session.infinite?)
|
220
|
+
assert(!@session.expired?)
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_session_can_tell_you_if_it_has_been_secured
|
224
|
+
mock = flexmock(Net::HTTP).should_receive(:post_form).and_return(example_auth_token_xml).once.ordered(:posts)
|
225
|
+
mock.should_receive(:post_form).and_return(example_get_session_xml.sub(/1173309298/, (Time.now + 60).to_i.to_s)).once.ordered(:posts)
|
226
|
+
@session.secure!
|
227
|
+
assert(@session.secured?)
|
228
|
+
end
|
229
|
+
|
230
|
+
def test_can_get_photos_by_pids
|
231
|
+
expect_http_posts_with_responses(example_get_photo_xml)
|
232
|
+
photos = @session.get_photos([97503428461115590, 97503428461115573])
|
233
|
+
assert_equal 2, photos.size
|
234
|
+
assert_equal "Rooftop barbecues make me act funny", photos.first.caption
|
235
|
+
assert_equal "97503428461115590", photos[0].id
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_can_get_photos_by_subject_and_album
|
239
|
+
expect_http_posts_with_responses(example_get_photo_xml)
|
240
|
+
photos = @session.get_photos(nil, 22701786, 97503428432802022 )
|
241
|
+
assert_equal '97503428432802022', photos.first.aid
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_getting_photos_requires_arguments
|
245
|
+
mock_http = establish_session
|
246
|
+
assert_raise(ArgumentError) { @session.get_photos() }
|
247
|
+
end
|
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
|
+
|
256
|
+
def test_can_get_albums_for_user
|
257
|
+
expect_http_posts_with_responses(example_user_albums_xml)
|
258
|
+
assert_equal('Summertime is Best', @session.user.albums.first.name)
|
259
|
+
assert_equal(2, @session.user.albums.size)
|
260
|
+
end
|
261
|
+
|
262
|
+
def test_can_get_albums_by_album_ids
|
263
|
+
expect_http_posts_with_responses(example_user_albums_xml)
|
264
|
+
albums = @session.get_albums([97503428432802022, 97503428432797817] )
|
265
|
+
assert_equal('Summertime is Best', albums[0].name)
|
266
|
+
assert_equal('Bonofon\'s Recital', albums[1].name)
|
267
|
+
end
|
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
|
+
|
276
|
+
def test_can_get_user_stream
|
277
|
+
expect_http_posts_with_responses(example_user_stream_xml)
|
278
|
+
stream = @session.user.stream
|
279
|
+
assert stream[:albums].empty?
|
280
|
+
assert_equal('The bbc home page', stream[:posts].first['message'])
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_can_create_album
|
284
|
+
expect_http_posts_with_responses(example_new_album_xml)
|
285
|
+
assert_equal "My Empty Album", @session.user.create_album(:name => "My Empty Album", :location => "Limboland").name
|
286
|
+
end
|
287
|
+
|
288
|
+
def test_can_upload_photo
|
289
|
+
mock_http = establish_session
|
290
|
+
mock_http.should_receive(:post_multipart_form).and_return(example_upload_photo_xml).once.ordered(:posts)
|
291
|
+
f = Net::HTTP::MultipartPostFile.new("image.jpg", "image/jpeg", "RAW DATA")
|
292
|
+
assert_equal "Under the sunset", @session.user.upload_photo(f).caption
|
293
|
+
end
|
294
|
+
|
295
|
+
def test_can_upload_native_strings
|
296
|
+
expect_http_posts_with_responses(example_upload_native_string_xml)
|
297
|
+
assert_equal "1", @session.upload_native_strings([:text => "Hello!", :description => "A common salutation."])
|
298
|
+
end
|
299
|
+
|
300
|
+
def test_can_get_photo_tags
|
301
|
+
expect_http_posts_with_responses(example_photo_tags_xml)
|
302
|
+
assert_instance_of Facebooker::Tag, @session.get_tags(:pids => 97503428461115571 ).first
|
303
|
+
end
|
304
|
+
|
305
|
+
# TODO: how to test that tags were created properly? Response doesn't contain much
|
306
|
+
def test_can_tag_a_user_in_a_photo
|
307
|
+
expect_http_posts_with_responses(example_add_tag_xml)
|
308
|
+
assert !@session.add_tags(pid = 97503428461115571, x= 30.0, y = 62.5, tag_uid = 1234567890).nil?
|
309
|
+
end
|
310
|
+
|
311
|
+
def test_can_add_multiple_tags_to_photos
|
312
|
+
end
|
313
|
+
|
314
|
+
def test_can_get_coordinates_for_photo_tags
|
315
|
+
expect_http_posts_with_responses(example_photo_tags_xml)
|
316
|
+
tag = @session.get_tags([97503428461115571]).first
|
317
|
+
assert_equal ['65.4248', '16.8627'], tag.coordinates
|
318
|
+
end
|
319
|
+
|
320
|
+
def test_can_upload_video
|
321
|
+
mock_http = establish_session
|
322
|
+
mock_http.should_receive(:post_multipart_form).and_return(example_upload_video_xml).once
|
323
|
+
f = Net::HTTP::MultipartPostFile.new("party.mp4", "video/mpeg", "RAW DATA")
|
324
|
+
assert_equal "Some Epic", @session.user.upload_video(f).title
|
325
|
+
end
|
326
|
+
|
327
|
+
def test_can_get_app_profile_fbml_for_user
|
328
|
+
expect_http_posts_with_responses(example_get_fbml_xml)
|
329
|
+
assert_match(/My profile!/, @session.user.profile_fbml)
|
330
|
+
end
|
331
|
+
|
332
|
+
def test_can_set_app_profile_fbml_for_user
|
333
|
+
expect_http_posts_with_responses(example_set_fbml_xml)
|
334
|
+
assert_nothing_raised {
|
335
|
+
@session.user.profile_fbml = 'aha!'
|
336
|
+
}
|
337
|
+
end
|
338
|
+
|
339
|
+
def test_get_logged_in_user
|
340
|
+
expect_http_posts_with_responses(example_get_logged_in_user_xml)
|
341
|
+
assert_equal 1240077, @session.post('facebook.users.getLoggedInUser', :session_key => @session.session_key)
|
342
|
+
end
|
343
|
+
|
344
|
+
def test_pages_get_info
|
345
|
+
expect_http_posts_with_responses(example_pages_get_info_xml)
|
346
|
+
info = {
|
347
|
+
'page_id' => '4846711747',
|
348
|
+
'name' => 'Kronos Quartet',
|
349
|
+
'website' => 'http://www.kronosquartet.org',
|
350
|
+
'company_overview' => ""
|
351
|
+
}
|
352
|
+
assert_equal [info], @session.post('facebook.pages.getInfo', :fields => ['company_overview', 'website', 'name', 'page_id'].join(','), :page_ids => [4846711747].join(','))
|
353
|
+
end
|
354
|
+
|
355
|
+
def test_pages_is_admin_true
|
356
|
+
expect_http_posts_with_responses(example_pages_is_admin_true_xml)
|
357
|
+
assert_equal true, @session.post('facebook.pages.isAdmin', :page_id => 123)
|
358
|
+
end
|
359
|
+
|
360
|
+
def test_pages_is_admin_false
|
361
|
+
expect_http_posts_with_responses(example_pages_is_admin_false_xml)
|
362
|
+
assert_equal false, @session.post('facebook.pages.isAdmin', :page_id => 123)
|
363
|
+
end
|
364
|
+
|
365
|
+
def test_pages_is_fan_true
|
366
|
+
expect_http_posts_with_responses(example_pages_is_fan_true_xml)
|
367
|
+
assert_equal true, @session.post('facebook.pages.isFan', :page_id => 123)
|
368
|
+
end
|
369
|
+
|
370
|
+
def test_pages_is_fan_false
|
371
|
+
expect_http_posts_with_responses(example_pages_is_fan_false_xml)
|
372
|
+
assert_equal false, @session.post('facebook.pages.isFan', :page_id => 123)
|
373
|
+
end
|
374
|
+
|
375
|
+
def test_users_set_status_true
|
376
|
+
expect_http_posts_with_responses(example_users_set_status_true_xml)
|
377
|
+
assert_equal true, @session.post('facebook.users.setStatus', :uid => 123, :status => 'message')
|
378
|
+
end
|
379
|
+
|
380
|
+
def test_users_set_status_false
|
381
|
+
expect_http_posts_with_responses(example_users_set_status_false_xml)
|
382
|
+
assert_equal false, @session.post('facebook.users.setStatus', :uid => 123, :status => 'message')
|
383
|
+
end
|
384
|
+
|
385
|
+
def test_desktop_apps_cannot_request_to_get_or_set_profile_fbml_for_any_user_other_than_logged_in_user
|
386
|
+
mock_http = establish_session(@desktop_session)
|
387
|
+
mock_http.should_receive(:post_form).and_return(example_friends_xml).once.ordered(:posts)
|
388
|
+
assert_raises(Facebooker::NonSessionUser) {
|
389
|
+
@desktop_session.user.friends.first.profile_fbml
|
390
|
+
}
|
391
|
+
assert_raises(Facebooker::NonSessionUser) {
|
392
|
+
@desktop_session.user.friends.first.profile_fbml = "O rly"
|
393
|
+
}
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_revoke_authorization_true
|
397
|
+
expect_http_posts_with_responses(example_revoke_authorization_true)
|
398
|
+
assert_equal true, @session.post('facebook.auth.revokeAuthorization', :uid => 123)
|
399
|
+
end
|
400
|
+
|
401
|
+
def test_revoke_authorization_false
|
402
|
+
expect_http_posts_with_responses(example_revoke_authorization_false)
|
403
|
+
assert_equal false, @session.post('facebook.auth.revokeAuthorization', :uid => 123)
|
404
|
+
end
|
405
|
+
|
406
|
+
def test_revoke_extended_permission
|
407
|
+
expect_http_posts_with_responses(example_revoke_extended_permission)
|
408
|
+
assert_equal true, @session.post('facebook.auth.revokeExtendedPermission', {:perm => 'email', :uid => 123}, false)
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_remove_comment_true
|
412
|
+
expect_http_posts_with_responses(example_remove_comment_true)
|
413
|
+
assert_equal true, @session.remove_comment('pete_comments',123)
|
414
|
+
end
|
415
|
+
|
416
|
+
def test_remove_comment_false
|
417
|
+
expect_http_posts_with_responses(example_remove_comment_false)
|
418
|
+
assert_equal false, @session.remove_comment('pete_comments',123)
|
419
|
+
end
|
420
|
+
|
421
|
+
# We can have lists in not list item, see ewample_with_list_in_none_list_item_xml : there is comment_list in comments node
|
422
|
+
def test_parser_with_list_item_in_not_list_item
|
423
|
+
expect_http_posts_with_responses(ewample_with_list_in_none_list_item_xml)
|
424
|
+
response = @session.fql_query('Lets be frank. We are not testing the query here')
|
425
|
+
assert_equal 3, response.first["comments"]['comment_list'].size
|
426
|
+
assert_equal "ahahhahaha\n i don't know the original one, but this is awesome (without waiting for it)", response.first["comments"]['comment_list'].first['text']
|
427
|
+
end
|
428
|
+
|
429
|
+
|
430
|
+
private
|
431
|
+
def populate_user_info
|
432
|
+
mock_http = establish_session
|
433
|
+
mock_http.should_receive(:post_form).and_return(example_user_info_xml).once
|
434
|
+
@session.user.populate
|
435
|
+
end
|
436
|
+
|
437
|
+
def populate_user_info_with_limited_fields
|
438
|
+
expect_http_posts_with_responses(example_limited_user_info_xml)
|
439
|
+
@session.user.populate(:affiliations, :status, :meeting_for)
|
440
|
+
end
|
441
|
+
|
442
|
+
def populate_session_friends
|
443
|
+
expect_http_posts_with_responses(example_friends_xml, example_user_info_xml)
|
444
|
+
@session.user.friends!
|
445
|
+
end
|
446
|
+
|
447
|
+
def populate_session_friends_with_limited_fields
|
448
|
+
expect_http_posts_with_responses(example_friends_xml, example_limited_user_info_xml)
|
449
|
+
@session.user.friends!(:affiliations, :status, :meeting_for)
|
450
|
+
end
|
451
|
+
|
452
|
+
def populate_session_friends_with_nil_data
|
453
|
+
expect_http_posts_with_responses(example_friends_xml, example_nil_user_info_xml)
|
454
|
+
@session.user.friends!(:name, :current_location, :pic)
|
455
|
+
end
|
456
|
+
|
457
|
+
def sample_args_to_post
|
458
|
+
{:method=>"facebook.auth.createToken", :sig=>"18b3dc4f5258a63c0ad641eebd3e3930"}
|
459
|
+
end
|
460
|
+
|
461
|
+
def example_pages_get_info_xml
|
462
|
+
<<-XML
|
463
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
464
|
+
<pages_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">
|
465
|
+
<page>
|
466
|
+
<page_id>4846711747</page_id>
|
467
|
+
<name>Kronos Quartet</name>
|
468
|
+
<website>http://www.kronosquartet.org</website>
|
469
|
+
<company_overview/>
|
470
|
+
</page>
|
471
|
+
</pages_getInfo_response>
|
472
|
+
XML
|
473
|
+
end
|
474
|
+
|
475
|
+
def example_pages_is_admin_true_xml
|
476
|
+
<<-XML
|
477
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
478
|
+
<pages_isAdmin_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</pages_isAdmin_response>
|
479
|
+
XML
|
480
|
+
end
|
481
|
+
|
482
|
+
def example_pages_is_admin_false_xml
|
483
|
+
<<-XML
|
484
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
485
|
+
<pages_isAdmin_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">0</pages_isAdmin_response>
|
486
|
+
XML
|
487
|
+
end
|
488
|
+
|
489
|
+
def example_pages_is_fan_true_xml
|
490
|
+
<<-XML
|
491
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
492
|
+
<pages_isFan_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</pages_isFan_response>
|
493
|
+
XML
|
494
|
+
end
|
495
|
+
|
496
|
+
def example_pages_is_fan_false_xml
|
497
|
+
<<-XML
|
498
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
499
|
+
<pages_isFan_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">0</pages_isFan_response>
|
500
|
+
XML
|
501
|
+
end
|
502
|
+
|
503
|
+
def example_users_set_status_true_xml
|
504
|
+
<<-XML
|
505
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
506
|
+
<users_setStatus_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</users_setStatus_response>
|
507
|
+
XML
|
508
|
+
end
|
509
|
+
|
510
|
+
def example_users_set_status_false_xml
|
511
|
+
<<-XML
|
512
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
513
|
+
<users_setStatus_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">0</users_setStatus_response>
|
514
|
+
XML
|
515
|
+
end
|
516
|
+
|
517
|
+
def example_set_fbml_xml
|
518
|
+
<<-XML
|
519
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
520
|
+
<profile_setFBML_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</profile_setFBML_response>
|
521
|
+
XML
|
522
|
+
end
|
523
|
+
|
524
|
+
def example_get_fbml_xml
|
525
|
+
<<-XML
|
526
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
527
|
+
<profile_getFBML_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">
|
528
|
+
<fb:if-is-own-profile>My profile!
|
529
|
+
<fb:else> Not my profile!</fb:else>
|
530
|
+
</fb:if-is-own-profile>
|
531
|
+
</profile_getFBML_response>
|
532
|
+
XML
|
533
|
+
end
|
534
|
+
|
535
|
+
def example_notifications_send_xml
|
536
|
+
<<-XML
|
537
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
538
|
+
<notifications_send_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">http://www.facebook.com/send_email.php?from=211031&id=52</notifications_send_response>
|
539
|
+
XML
|
540
|
+
end
|
541
|
+
|
542
|
+
def example_notifications_send_email_xml
|
543
|
+
<<-XML
|
544
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
545
|
+
<notifications_sendEmail_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">123,321</notifications_sendEmail_response>
|
546
|
+
XML
|
547
|
+
end
|
548
|
+
|
549
|
+
def example_request_send_xml
|
550
|
+
<<-XML
|
551
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
552
|
+
<notifications_sendRequest_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">http://www.facebook.com/send_req.php?from=211031&id=6</notifications_sendRequest_response>
|
553
|
+
XML
|
554
|
+
end
|
555
|
+
|
556
|
+
def example_notifications_get_xml
|
557
|
+
<<-XML
|
558
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
559
|
+
<notifications_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">
|
560
|
+
<messages>
|
561
|
+
<unread>1</unread>
|
562
|
+
<most_recent>1170644932</most_recent>
|
563
|
+
</messages>
|
564
|
+
<pokes>
|
565
|
+
<unread>0</unread>
|
566
|
+
<most_recent>0</most_recent>
|
567
|
+
</pokes>
|
568
|
+
<shares>
|
569
|
+
<unread>1</unread>
|
570
|
+
<most_recent>1170657686</most_recent>
|
571
|
+
</shares>
|
572
|
+
<friend_requests list="true">
|
573
|
+
<uid>2231342839</uid>
|
574
|
+
<uid>2231511925</uid>
|
575
|
+
<uid>2239284527</uid>
|
576
|
+
</friend_requests>
|
577
|
+
<group_invites list="true"/>
|
578
|
+
<event_invites list="true"/>
|
579
|
+
</notifications_get_response>
|
580
|
+
XML
|
581
|
+
end
|
582
|
+
|
583
|
+
def example_publish_story_xml
|
584
|
+
<<-XML
|
585
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
586
|
+
<feed_publishStoryToUser_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</feed_publishStoryToUser_response>
|
587
|
+
XML
|
588
|
+
end
|
589
|
+
|
590
|
+
def example_publish_action_xml
|
591
|
+
<<-XML
|
592
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
593
|
+
<feed_publishActionOfUser_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</feed_publishActionOfUser_response>
|
594
|
+
XML
|
595
|
+
end
|
596
|
+
|
597
|
+
def example_publish_templatized_action_xml
|
598
|
+
<<-XML
|
599
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
600
|
+
<feed_publishTemplatizedAction_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">
|
601
|
+
<feed_publishTemplatizedAction_response_elt>1</feed_publishTemplatizedAction_response_elt>
|
602
|
+
</feed_publishTemplatizedAction_response>
|
603
|
+
XML
|
604
|
+
end
|
605
|
+
|
606
|
+
def example_deactivate_template_bundle_by_id_xml
|
607
|
+
<<-XML
|
608
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
609
|
+
<feed_deactivateTemplateBundleByID_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/">1</feed_deactivateTemplateBundleByID_response>
|
610
|
+
XML
|
611
|
+
end
|
612
|
+
|
613
|
+
def example_user_info_xml
|
614
|
+
<<-XML
|
615
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
616
|
+
<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">
|
617
|
+
<user>
|
618
|
+
<uid>222333</uid>
|
619
|
+
<about_me>This field perpetuates the glorification of the ego. Also, it has a character limit.</about_me>
|
620
|
+
<activities>Here: facebook, etc. There: Glee Club, a capella, teaching.</activities>
|
621
|
+
<affiliations list="true">
|
622
|
+
<affiliation>
|
623
|
+
<nid>50453093</nid>
|
624
|
+
<name>Facebook Developers</name>
|
625
|
+
<type>work</type>
|
626
|
+
<status/>
|
627
|
+
<year/>
|
628
|
+
</affiliation>
|
629
|
+
</affiliations>
|
630
|
+
<birthday>November 3</birthday>
|
631
|
+
<books>The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar</books>
|
632
|
+
<current_location>
|
633
|
+
<city>Palo Alto</city>
|
634
|
+
<state>CA</state>
|
635
|
+
<country>United States</country>
|
636
|
+
<zip>94303</zip>
|
637
|
+
</current_location>
|
638
|
+
<education_history list="true">
|
639
|
+
<education_info>
|
640
|
+
<name>Harvard</name>
|
641
|
+
<year>2003</year>
|
642
|
+
<concentrations list="true">
|
643
|
+
<concentration>Applied Mathematics</concentration>
|
644
|
+
<concentration>Computer Science</concentration>
|
645
|
+
</concentrations>
|
646
|
+
<degree>Masters</degree>
|
647
|
+
</education_info>
|
648
|
+
</education_history>
|
649
|
+
<first_name>Dave</first_name>
|
650
|
+
<hometown_location>
|
651
|
+
<city>York</city>
|
652
|
+
<state>PA</state>
|
653
|
+
<country>United States</country>
|
654
|
+
<zip>0</zip>
|
655
|
+
</hometown_location>
|
656
|
+
<hs_info>
|
657
|
+
<hs1_name>Central York High School</hs1_name>
|
658
|
+
<hs2_name/>
|
659
|
+
<grad_year>1999</grad_year>
|
660
|
+
<hs1_id>21846</hs1_id>
|
661
|
+
<hs2_id>0</hs2_id>
|
662
|
+
</hs_info>
|
663
|
+
<is_app_user>1</is_app_user>
|
664
|
+
<has_added_app>1</has_added_app>
|
665
|
+
<interests>coffee, computers, the funny, architecture, code breaking,snowboarding, philosophy, soccer, talking to strangers</interests>
|
666
|
+
<last_name>Fetterman</last_name>
|
667
|
+
<meeting_for list="true">
|
668
|
+
<seeking>Friendship</seeking>
|
669
|
+
</meeting_for>
|
670
|
+
<meeting_sex list="true">
|
671
|
+
<sex>female</sex>
|
672
|
+
</meeting_sex>
|
673
|
+
<movies>Tommy Boy, Billy Madison, Fight Club, Dirty Work, Meet the Parents, My Blue Heaven, Office Space </movies>
|
674
|
+
<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>
|
675
|
+
<name>Dave Fetterman</name>
|
676
|
+
<notes_count>0</notes_count>
|
677
|
+
<pic>http://photos-055.facebook.com/ip007/profile3/1271/65/s8055_39735.jpg</pic>
|
678
|
+
<pic_big>http://photos-055.facebook.com/ip007/profile3/1271/65/n8055_39735.jpg</pic_big>
|
679
|
+
<pic_small>http://photos-055.facebook.com/ip007/profile3/1271/65/t8055_39735.jpg</pic_small>
|
680
|
+
<pic_square>http://photos-055.facebook.com/ip007/profile3/1271/65/q8055_39735.jpg</pic_square>
|
681
|
+
<political>Moderate</political>
|
682
|
+
<profile_update_time>1170414620</profile_update_time>
|
683
|
+
<quotes/>
|
684
|
+
<relationship_status>In a Relationship</relationship_status>
|
685
|
+
<religion/>
|
686
|
+
<sex>male</sex>
|
687
|
+
<significant_other_id xsi:nil="true"/>
|
688
|
+
<status>
|
689
|
+
<message>I rule</message>
|
690
|
+
<time>0</time>
|
691
|
+
</status>
|
692
|
+
<timezone>-8</timezone>
|
693
|
+
<tv>cf. Bob Trahan</tv>
|
694
|
+
<wall_count>121</wall_count>
|
695
|
+
<work_history list="true">
|
696
|
+
<work_info>
|
697
|
+
<location>
|
698
|
+
<city>Palo Alto</city>
|
699
|
+
<state>CA</state>
|
700
|
+
<country>United States</country>
|
701
|
+
</location>
|
702
|
+
<company_name>Facebook</company_name>
|
703
|
+
<position>Software Engineer</position>
|
704
|
+
<description>Tech Lead, Facebook Platform</description>
|
705
|
+
<start_date>2006-01</start_date>
|
706
|
+
<end_date/>
|
707
|
+
</work_info>
|
708
|
+
</work_history>
|
709
|
+
</user>
|
710
|
+
<user>
|
711
|
+
<uid>1240079</uid>
|
712
|
+
<about_me>I am here.</about_me>
|
713
|
+
<activities>Party.</activities>
|
714
|
+
</user>
|
715
|
+
</users_getInfo_response>
|
716
|
+
XML
|
717
|
+
end
|
718
|
+
|
719
|
+
def example_limited_user_info_xml
|
720
|
+
<<-XML
|
721
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
722
|
+
<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">
|
723
|
+
<user>
|
724
|
+
<uid>222333</uid>
|
725
|
+
<affiliations list="true">
|
726
|
+
<affiliation>
|
727
|
+
<nid>50453093</nid>
|
728
|
+
<name>Facebook Developers</name>
|
729
|
+
<type>work</type>
|
730
|
+
<status/>
|
731
|
+
<year/>
|
732
|
+
</affiliation>
|
733
|
+
</affiliations>
|
734
|
+
<meeting_for list="true">
|
735
|
+
<seeking>Friendship</seeking>
|
736
|
+
</meeting_for>
|
737
|
+
<status>
|
738
|
+
<message>I rule</message>
|
739
|
+
<time>0</time>
|
740
|
+
</status>
|
741
|
+
</user>
|
742
|
+
<user>
|
743
|
+
<uid>1240079</uid>
|
744
|
+
<activities>Party.</activities>
|
745
|
+
</user>
|
746
|
+
</users_getInfo_response>
|
747
|
+
XML
|
748
|
+
end
|
749
|
+
|
750
|
+
|
751
|
+
def example_nil_user_info_xml
|
752
|
+
<<-XML
|
753
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
754
|
+
<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">
|
755
|
+
<user>
|
756
|
+
<uid>222333</uid>
|
757
|
+
<name>Kevin Lochner</name>
|
758
|
+
<current_location xsi:nil="true"/>
|
759
|
+
<pic xsi:nil="true"/>
|
760
|
+
</user>
|
761
|
+
</users_getInfo_response>
|
762
|
+
XML
|
763
|
+
end
|
764
|
+
|
765
|
+
|
766
|
+
def example_friends_xml
|
767
|
+
<<-XML
|
768
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
769
|
+
<friends_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">
|
770
|
+
<uid>222333</uid>
|
771
|
+
<uid>1240079</uid>
|
772
|
+
</friends_get_response>
|
773
|
+
XML
|
774
|
+
end
|
775
|
+
|
776
|
+
def example_friend_lists_xml
|
777
|
+
<<-XML
|
778
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
779
|
+
<friends_getLists_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">
|
780
|
+
<friendlist>
|
781
|
+
<flid>12089150545</flid>
|
782
|
+
<name>Family</name>
|
783
|
+
</friendlist>
|
784
|
+
<friendlist>
|
785
|
+
<flid>16361710545</flid>
|
786
|
+
<name>Entrepreneuer</name>
|
787
|
+
</friendlist>
|
788
|
+
</friends_getLists_response>
|
789
|
+
XML
|
790
|
+
end
|
791
|
+
|
792
|
+
def example_get_logged_in_user_xml
|
793
|
+
<<-XML
|
794
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
795
|
+
<users_getLoggedInUser_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">1240077</users_getLoggedInUser_response>
|
796
|
+
XML
|
797
|
+
end
|
798
|
+
|
799
|
+
def example_invalid_api_key_error_response
|
800
|
+
<<-XML
|
801
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
802
|
+
<error_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">
|
803
|
+
<error_code>101</error_code>
|
804
|
+
<error_msg>Invalid API key</error_msg>
|
805
|
+
<request_args list="true">
|
806
|
+
<arg>
|
807
|
+
<key>v</key>
|
808
|
+
<value>1.0</value>
|
809
|
+
</arg>
|
810
|
+
<arg>
|
811
|
+
<key>method</key>
|
812
|
+
<value>facebook.auth.createToken</value>
|
813
|
+
</arg>
|
814
|
+
<arg>
|
815
|
+
<key>sig</key>
|
816
|
+
<value>611f5f44e55f3fe17f858a8de84a4b0a</value>
|
817
|
+
</arg>
|
818
|
+
<arg>
|
819
|
+
<key>call_id</key>
|
820
|
+
<value>1186088346.82142</value>
|
821
|
+
</arg>
|
822
|
+
</request_args>
|
823
|
+
</error_response>
|
824
|
+
XML
|
825
|
+
end
|
826
|
+
|
827
|
+
def example_session_expired_error_response
|
828
|
+
<<-XML
|
829
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
830
|
+
<error_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">
|
831
|
+
<error_code>102</error_code>
|
832
|
+
<error_msg>Session Expired</error_msg>
|
833
|
+
<request_args list="true">
|
834
|
+
<arg>
|
835
|
+
<key>v</key>
|
836
|
+
<value>1.0</value>
|
837
|
+
</arg>
|
838
|
+
<arg>
|
839
|
+
<key>method</key>
|
840
|
+
<value>facebook.auth.createToken</value>
|
841
|
+
</arg>
|
842
|
+
<arg>
|
843
|
+
<key>sig</key>
|
844
|
+
<value>611f5f44e55f3fe17f858a8de84a4b0a</value>
|
845
|
+
</arg>
|
846
|
+
<arg>
|
847
|
+
<key>call_id</key>
|
848
|
+
<value>1186088346.82142</value>
|
849
|
+
</arg>
|
850
|
+
</request_args>
|
851
|
+
</error_response>
|
852
|
+
XML
|
853
|
+
end
|
854
|
+
|
855
|
+
def example_app_users_xml
|
856
|
+
<<-XML
|
857
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
858
|
+
<friends_getAppUsers_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">
|
859
|
+
<uid>222333</uid>
|
860
|
+
<uid>1240079</uid>
|
861
|
+
</friends_getAppUsers_response>
|
862
|
+
XML
|
863
|
+
end
|
864
|
+
|
865
|
+
def example_comments_xml
|
866
|
+
<<-XML
|
867
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
868
|
+
<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">
|
869
|
+
<comment>
|
870
|
+
<xid>pete_comments</xid>
|
871
|
+
<fromid>563683308</fromid>
|
872
|
+
<time>1234227529</time>
|
873
|
+
<text>Hola</text>
|
874
|
+
<id>65020</id>
|
875
|
+
</comment>
|
876
|
+
<comment>
|
877
|
+
<xid>pete_comments</xid>
|
878
|
+
<fromid>563683308</fromid>
|
879
|
+
<time>1234227542</time>
|
880
|
+
<text>holla</text>
|
881
|
+
<id>65021</id>
|
882
|
+
</comment>
|
883
|
+
</comments_get_response>
|
884
|
+
XML
|
885
|
+
end
|
886
|
+
|
887
|
+
def example_user_albums_xml
|
888
|
+
<<-XML
|
889
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
890
|
+
<photos_getAlbums_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">
|
891
|
+
<album>
|
892
|
+
<aid>97503428432802022</aid>
|
893
|
+
<cover_pid>97503428461115574</cover_pid>
|
894
|
+
<owner>22701786</owner>
|
895
|
+
<name>Summertime is Best</name>
|
896
|
+
<created>1184120648</created>
|
897
|
+
<modified>1185465771</modified>
|
898
|
+
<description>Happenings on or around Summer '07</description>
|
899
|
+
<location>Brooklyn, New York</location>
|
900
|
+
<link>http://www.facebook.com/album.php?aid=2011366&id=22701786</link>
|
901
|
+
<size>49</size>
|
902
|
+
</album>
|
903
|
+
<album>
|
904
|
+
<aid>97503428432797817</aid>
|
905
|
+
<cover_pid>97503428460977993</cover_pid>
|
906
|
+
<owner>22701786</owner>
|
907
|
+
<name>Bonofon's Recital</name>
|
908
|
+
<created>1165356279</created>
|
909
|
+
<modified>1165382364</modified>
|
910
|
+
<description>The whole Ewing fam flies out to flatland to watch the Bonofon's senior recital. That boy sure can tinkle them ivories.</description>
|
911
|
+
<location>Grinnell College, Grinnell Iowa</location>
|
912
|
+
<link>http://www.facebook.com/album.php?aid=2007161&id=22701786</link>
|
913
|
+
<size>14</size>
|
914
|
+
</album>
|
915
|
+
</photos_getAlbums_response>
|
916
|
+
XML
|
917
|
+
end
|
918
|
+
|
919
|
+
def example_user_stream_xml
|
920
|
+
<<-XML
|
921
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
922
|
+
<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">
|
923
|
+
<posts list="true">
|
924
|
+
<stream_post>
|
925
|
+
<post_id>100000637452380_329182455865</post_id>
|
926
|
+
<viewer_id>100000637452380</viewer_id>
|
927
|
+
<source_id>100000637452380</source_id>
|
928
|
+
<type>80</type>
|
929
|
+
<app_id>2309869772</app_id>
|
930
|
+
<attribution xsi:nil="true"/>
|
931
|
+
<actor_id>100000637452380</actor_id>
|
932
|
+
<target_id xsi:nil="true"/>
|
933
|
+
<message>The bbc home page</message>
|
934
|
+
<attachment>
|
935
|
+
<media list="true">
|
936
|
+
<stream_media>
|
937
|
+
<href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.bbc.co.uk%252F&h=d6020258c74e511ee6dc1c28746f1e31</href>
|
938
|
+
<type>link</type>
|
939
|
+
<src>http://external.ak.fbcdn.net/safe_image.php?d=d1e587ce2d7039feaceaf7ef4c2610cd&w=90&h=90&url=http%3A%2F%2Fwww.bbc.co.uk%2Ffeedengine%2Fhomepage%2Fimages%2F_47351229_-1_201x150.jpg</src>
|
940
|
+
</stream_media>
|
941
|
+
</media>
|
942
|
+
<name>BBC - Homepage</name>
|
943
|
+
<href>http://www.facebook.com/l.php?u=http%253A%252F%252Fwww.bbc.co.uk%252F&h=d6020258c74e511ee6dc1c28746f1e31</href>
|
944
|
+
<caption>www.bbc.co.uk</caption>
|
945
|
+
<description>Breaking news, sport, TV, radio and a whole lot more. The BBC informs, educates and entertains - wherever you are, whatever your age.</description>
|
946
|
+
<properties list="true"/>
|
947
|
+
<icon>http://static.ak.fbcdn.net/rsrc.php/zAXEX/hash/9yvl71tw.png</icon>
|
948
|
+
<fb_object_type/>
|
949
|
+
<fb_object_id/>
|
950
|
+
</attachment>
|
951
|
+
<app_data/>
|
952
|
+
<action_links xsi:nil="true"/>
|
953
|
+
<comments>
|
954
|
+
<can_remove>1</can_remove>
|
955
|
+
<can_post>1</can_post>
|
956
|
+
<count>1</count>
|
957
|
+
<comment_list list="true">
|
958
|
+
<comment>
|
959
|
+
<fromid>100000702701175</fromid>
|
960
|
+
<time>1267118534</time>
|
961
|
+
<text>I like this website!</text>
|
962
|
+
<id>100000637452380_329182455865_11562840</id>
|
963
|
+
</comment>
|
964
|
+
</comment_list>
|
965
|
+
</comments>
|
966
|
+
<likes>
|
967
|
+
<href>http://www.facebook.com/social_graph.php?node_id=329182455865&class=LikeManager</href>
|
968
|
+
<count>1</count>
|
969
|
+
<sample list="true"/>
|
970
|
+
<friends list="true">
|
971
|
+
<uid>100000702701175</uid>
|
972
|
+
</friends>
|
973
|
+
<user_likes>0</user_likes>
|
974
|
+
<can_like>1</can_like>
|
975
|
+
</likes>
|
976
|
+
<privacy>
|
977
|
+
<description>Everyone</description>
|
978
|
+
<value>EVERYONE</value>
|
979
|
+
<friends>NO_FRIENDS</friends>
|
980
|
+
<networks/>
|
981
|
+
<allow/>
|
982
|
+
<deny/>
|
983
|
+
</privacy>
|
984
|
+
<updated_time>1267118534</updated_time>
|
985
|
+
<created_time>1267103491</created_time>
|
986
|
+
<tagged_ids list="true"/>
|
987
|
+
<is_hidden>0</is_hidden>
|
988
|
+
<filter_key/>
|
989
|
+
<permalink>http://www.facebook.com/profile.php?v=feed&story_fbid=329182455865&id=100000637452380</permalink>
|
990
|
+
</stream_post>
|
991
|
+
<stream_post>
|
992
|
+
<post_id>100000637452380_318491734561</post_id>
|
993
|
+
<viewer_id>100000637452380</viewer_id>
|
994
|
+
<source_id>100000637452380</source_id>
|
995
|
+
<type>237</type>
|
996
|
+
<app_id>22108119377</app_id>
|
997
|
+
<attribution>Digg.com</attribution>
|
998
|
+
<actor_id>100000637452380</actor_id>
|
999
|
+
<target_id xsi:nil="true"/>
|
1000
|
+
<message>What is curling.</message>
|
1001
|
+
<attachment>
|
1002
|
+
<media list="true">
|
1003
|
+
<stream_media>
|
1004
|
+
<href>http://digg.com/olympics/Curling_Finally_Explained_InfoGraphic?OTC-fbc8</href>
|
1005
|
+
<type>link</type>
|
1006
|
+
<src>http://platform.ak.fbcdn.net/www/app_full_proxy.php?app=22108119377&v=1&size=z&cksum=f8ecb50623115ff74e5ea8acd9cf4a2e&src=http%3A%2F%2Fdigg.com%2Folympics%2FCurling_Finally_Explained_InfoGraphic%2Ft.jpg</src>
|
1007
|
+
</stream_media>
|
1008
|
+
</media>
|
1009
|
+
<name>Curling Finally Explained [InfoGraphic]</name>
|
1010
|
+
<href>http://digg.com/olympics/Curling_Finally_Explained_InfoGraphic?OTC-fbc1</href>
|
1011
|
+
<caption>Phudki dugg this story on Digg</caption>
|
1012
|
+
<description>At last, someone makes sense out of the weirdest sport of the Winter Olympics. </description>
|
1013
|
+
<properties list="true">
|
1014
|
+
<stream_property>
|
1015
|
+
<name>Source</name>
|
1016
|
+
<text>i.imgur.com</text>
|
1017
|
+
</stream_property>
|
1018
|
+
<stream_property>
|
1019
|
+
<name>Diggs</name>
|
1020
|
+
<text>247</text>
|
1021
|
+
</stream_property>
|
1022
|
+
</properties>
|
1023
|
+
<icon>http://photos-b.ak.fbcdn.net/photos-ak-sf2p/v43/113/22108119377/app_2_22108119377_6404.gif</icon>
|
1024
|
+
<fb_object_type/>
|
1025
|
+
<fb_object_id/>
|
1026
|
+
</attachment>
|
1027
|
+
<app_data>
|
1028
|
+
<attachment_data>{"name":"Curling Finally Explained [InfoGraphic]","href":"http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic?OTC-fbc1","description":"At last, someone makes sense out of the weirdest sport of the Winter Olympics. ","media":[{"type":"image","src":"http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic\/t.jpg","href":"http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic?OTC-fbc8"}],"caption":"{*actor*} dugg this story on Digg","properties":{"Source":"i.imgur.com","Diggs":"247"}}</attachment_data>
|
1029
|
+
<images>[{"fbml":"<img src=\"http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic\/t.jpg\" \/>","href":"http:\/\/digg.com\/olympics\/Curling_Finally_Explained_InfoGraphic?OTC-fbc8"}]</images>
|
1030
|
+
</app_data>
|
1031
|
+
<action_links xsi:nil="true"/>
|
1032
|
+
<comments>
|
1033
|
+
<can_remove>1</can_remove>
|
1034
|
+
<can_post>1</can_post>
|
1035
|
+
<count>0</count>
|
1036
|
+
<comment_list list="true"/>
|
1037
|
+
</comments>
|
1038
|
+
<likes>
|
1039
|
+
<href>http://www.facebook.com/social_graph.php?node_id=318491734561&class=LikeManager</href>
|
1040
|
+
<count>0</count>
|
1041
|
+
<sample list="true"/>
|
1042
|
+
<friends list="true"/>
|
1043
|
+
<user_likes>0</user_likes>
|
1044
|
+
<can_like>1</can_like>
|
1045
|
+
</likes>
|
1046
|
+
<privacy>
|
1047
|
+
<description>Everyone</description>
|
1048
|
+
<value>EVERYONE</value>
|
1049
|
+
<friends>NO_FRIENDS</friends>
|
1050
|
+
<networks/>
|
1051
|
+
<allow/>
|
1052
|
+
<deny/>
|
1053
|
+
</privacy>
|
1054
|
+
<updated_time>1266919509</updated_time>
|
1055
|
+
<created_time>1266919509</created_time>
|
1056
|
+
<tagged_ids list="true"/>
|
1057
|
+
<is_hidden>0</is_hidden>
|
1058
|
+
<filter_key/>
|
1059
|
+
<permalink>http://www.facebook.com/profile.php?v=feed&story_fbid=318491734561&id=100000637452380</permalink>
|
1060
|
+
</stream_post>
|
1061
|
+
</posts>
|
1062
|
+
<profiles list="true">
|
1063
|
+
<profile>
|
1064
|
+
<id>100000637452380</id>
|
1065
|
+
<url>http://www.facebook.com/profile.php?id=100000637452380</url>
|
1066
|
+
<name>Phudki Bandar</name>
|
1067
|
+
<pic_square>http://profile.ak.fbcdn.net/v22939/1286/112/q100000637452380_2062.jpg</pic_square>
|
1068
|
+
<type>user</type>
|
1069
|
+
</profile>
|
1070
|
+
<profile>
|
1071
|
+
<id>100000702701175</id>
|
1072
|
+
<url>http://www.facebook.com/profile.php?id=100000702701175</url>
|
1073
|
+
<name>Mahmood Tester</name>
|
1074
|
+
<pic_square>http://profile.ak.fbcdn.net/v22940/1631/70/q100000702701175_5464.jpg</pic_square>
|
1075
|
+
<type>user</type>
|
1076
|
+
</profile>
|
1077
|
+
</profiles>
|
1078
|
+
<albums list="true"/>
|
1079
|
+
</stream_get_response>
|
1080
|
+
XML
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
def example_upload_photo_xml
|
1084
|
+
<<-XML
|
1085
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1086
|
+
<photos_upload_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">
|
1087
|
+
<pid>940915697041656</pid>
|
1088
|
+
<aid>940915667462717</aid>
|
1089
|
+
<owner>219074</owner>
|
1090
|
+
<src>http://ip002.facebook.com/v67/161/72/219074/s219074_31637752_5455.jpg</src>
|
1091
|
+
<src_big>http://ip002.facebook.com/v67/161/72/219074/n219074_31637752_5455.jpg</src_big>
|
1092
|
+
<src_small>http://ip002.facebook.com/v67/161/72/219074/t219074_31637752_5455.jpg</src_small>
|
1093
|
+
<link>http://www.facebook.com/photo.php?pid=31637752&id=219074</link>
|
1094
|
+
<caption>Under the sunset</caption>
|
1095
|
+
</photos_upload_response>
|
1096
|
+
XML
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
def example_new_album_xml
|
1100
|
+
<<-XML
|
1101
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1102
|
+
<photos_createAlbum_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">
|
1103
|
+
<aid>34595963571485</aid>
|
1104
|
+
<cover_pid>0</cover_pid>
|
1105
|
+
<owner>8055</owner>
|
1106
|
+
<name>My Empty Album</name>
|
1107
|
+
<created>1132553109</created>
|
1108
|
+
<modified>1132553363</modified>
|
1109
|
+
<description>No I will not make out with you</description>
|
1110
|
+
<location>York, PA</location>
|
1111
|
+
<link>http://www.facebook.com/album.php?aid=2002205&id=8055</link>
|
1112
|
+
<size>0</size>
|
1113
|
+
</photos_createAlbum_response>
|
1114
|
+
XML
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
def example_photo_tags_xml
|
1118
|
+
<<-XML
|
1119
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1120
|
+
<photos_getTags_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">
|
1121
|
+
<photo_tag>
|
1122
|
+
<pid>97503428461115571</pid>
|
1123
|
+
<subject>570070524</subject>
|
1124
|
+
<xcoord>65.4248</xcoord>
|
1125
|
+
<ycoord>16.8627</ycoord>
|
1126
|
+
</photo_tag>
|
1127
|
+
</photos_getTags_response>
|
1128
|
+
XML
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
def example_add_tag_xml
|
1132
|
+
<<-XML
|
1133
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1134
|
+
<photos_addTag_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</photos_addTag_response>
|
1135
|
+
XML
|
1136
|
+
end
|
1137
|
+
|
1138
|
+
def example_get_photo_xml
|
1139
|
+
<<-XML
|
1140
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1141
|
+
<photos_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">
|
1142
|
+
<photo>
|
1143
|
+
<pid>97503428461115590</pid>
|
1144
|
+
<aid>97503428432802022</aid>
|
1145
|
+
<owner>22701786</owner>
|
1146
|
+
<src>http://photos-c.ak.facebook.com/photos-ak-sf2p/v77/74/112/22701786/s22701786_30324934_7816.jpg</src>
|
1147
|
+
<src_big>http://photos-c.ak.facebook.com/photos-ak-sf2p/v77/74/112/22701786/n22701786_30324934_7816.jpg</src_big>
|
1148
|
+
<src_small>http://photos-c.ak.facebook.com/photos-ak-sf2p/v77/74/112/22701786/t22701786_30324934_7816.jpg</src_small>
|
1149
|
+
<link>http://www.facebook.com/photo.php?pid=30324934&id=22701786</link>
|
1150
|
+
<caption>Rooftop barbecues make me act funny</caption>
|
1151
|
+
<created>1184120987</created>
|
1152
|
+
</photo>
|
1153
|
+
<photo>
|
1154
|
+
<pid>97503428461115573</pid>
|
1155
|
+
<aid>97503428432802022</aid>
|
1156
|
+
<owner>22701786</owner>
|
1157
|
+
<src>http://photos-b.ak.facebook.com/photos-ak-sf2p/v77/74/112/22701786/s22701786_30324917_4555.jpg</src>
|
1158
|
+
<src_big>http://photos-b.ak.facebook.com/photos-ak-sf2p/v77/74/112/22701786/n22701786_30324917_4555.jpg</src_big>
|
1159
|
+
<src_small>http://photos-b.ak.facebook.com/photos-ak-sf2p/v77/74/112/22701786/t22701786_30324917_4555.jpg</src_small>
|
1160
|
+
<link>http://www.facebook.com/photo.php?pid=30324917&id=22701786</link>
|
1161
|
+
<caption/>
|
1162
|
+
<created>1184120654</created>
|
1163
|
+
</photo>
|
1164
|
+
</photos_get_response>
|
1165
|
+
XML
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
def example_upload_video_xml
|
1169
|
+
<<-XML
|
1170
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1171
|
+
<video_upload_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">
|
1172
|
+
<vid>15943367753</vid>
|
1173
|
+
<title>Some Epic</title>
|
1174
|
+
<description>Check it out</description>
|
1175
|
+
<link>http://www.facebook.com/video/video.php?v=15943367753</link>
|
1176
|
+
</video_upload_response>
|
1177
|
+
XML
|
1178
|
+
end
|
1179
|
+
|
1180
|
+
def example_upload_native_string_xml
|
1181
|
+
<<-XML
|
1182
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1183
|
+
<intl_uploadNativeStrings_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</intl_uploadNativeStrings_response>
|
1184
|
+
XML
|
1185
|
+
end
|
1186
|
+
|
1187
|
+
def example_revoke_authorization_true
|
1188
|
+
"1"
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
def example_revoke_authorization_false
|
1192
|
+
"0"
|
1193
|
+
end
|
1194
|
+
|
1195
|
+
def example_revoke_extended_permission
|
1196
|
+
<<-XML
|
1197
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1198
|
+
<auth_revokeExtendedPermission_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</auth_revokeExtendedPermission_response>
|
1199
|
+
XML
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
def example_remove_comment_true
|
1203
|
+
"1"
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
def example_remove_comment_false
|
1207
|
+
"0"
|
1208
|
+
end
|
1209
|
+
|
1210
|
+
def ewample_with_list_in_none_list_item_xml
|
1211
|
+
<<-XML
|
1212
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
1213
|
+
<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
|
1214
|
+
<stream_post>
|
1215
|
+
<post_id>12345678_901234</post_id>
|
1216
|
+
<actor_id>12345</actor_id>
|
1217
|
+
<comments>
|
1218
|
+
<can_remove>1</can_remove>
|
1219
|
+
<can_post>1</can_post>
|
1220
|
+
<count>3</count>
|
1221
|
+
<comment_list list="true">
|
1222
|
+
<comment>
|
1223
|
+
<fromid>6667785</fromid>
|
1224
|
+
<time>2223332</time>
|
1225
|
+
<text>ahahhahaha
|
1226
|
+
i don't know the original one, but this is awesome (without waiting for it)</text>
|
1227
|
+
<id>12345678_901234_23456</id>
|
1228
|
+
</comment>
|
1229
|
+
<comment>
|
1230
|
+
<fromid>6667785</fromid>
|
1231
|
+
<time>1268732285</time>
|
1232
|
+
<text>héhé :)
|
1233
|
+
Have you listen their Mickeal Jackson's cover ?</text>
|
1234
|
+
<id>785637999_368045444730_12404854</id>
|
1235
|
+
</comment>
|
1236
|
+
<comment>
|
1237
|
+
<fromid>1345267</fromid>
|
1238
|
+
<time>1268733276</time>
|
1239
|
+
<text>not yet!
|
1240
|
+
unfortunately i'm at work so i can't go through all of them..
|
1241
|
+
but yes, i saw it
|
1242
|
+
brilliant!</text>
|
1243
|
+
<id>12345678_901234_234567</id>
|
1244
|
+
</comment>
|
1245
|
+
</comment_list>
|
1246
|
+
</comments>
|
1247
|
+
<likes>
|
1248
|
+
<href>http://www.facebook.com/social_graph.php?node_id=23546&class=LikeManager</href>
|
1249
|
+
<count>1</count>
|
1250
|
+
<sample list="true"/>
|
1251
|
+
<friends list="true">
|
1252
|
+
<uid>234567</uid>
|
1253
|
+
</friends>
|
1254
|
+
<user_likes>0</user_likes>
|
1255
|
+
<can_like>1</can_like>
|
1256
|
+
</likes>
|
1257
|
+
</stream_post>
|
1258
|
+
</fql_query_response>
|
1259
|
+
XML
|
1260
|
+
end
|
1261
|
+
|
1262
|
+
|
1263
|
+
end
|