mmangino-facebooker 1.0.30 → 1.0.31
Sign up to get free protection for your applications and to get access to all the features.
- data/facebooker.gemspec +2 -2
- data/generators/xd_receiver/xd_receiver_generator.rb +3 -2
- data/init.rb +1 -1
- data/lib/facebooker/parser.rb +11 -0
- data/lib/facebooker/rails/helpers/fb_connect.rb +5 -1
- data/lib/facebooker/version.rb +1 -1
- data/lib/facebooker.rb +2 -9
- data/test/facebooker/rails_integration_test.rb +32 -1
- data/test/facebooker_test.rb +109 -83
- metadata +2 -2
data/facebooker.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{facebooker}
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.31"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Chad Fowler", "Patrick Ewing", "Mike Mangino", "Shane Vitarana", "Corey Innis"]
|
9
|
-
s.date = %q{2009-04-
|
9
|
+
s.date = %q{2009-04-30}
|
10
10
|
s.description = %q{Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]. Its goals are:
|
11
11
|
|
12
12
|
* Idiomatic Ruby
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class XdReceiverGenerator < Rails::Generator::Base
|
2
2
|
def manifest
|
3
3
|
record do |m|
|
4
|
-
m.template "xd_receiver.html",
|
4
|
+
m.template "xd_receiver.html", "public/xd_receiver.html"
|
5
|
+
m.template "xd_receiver_ssl.html", "public/xd_receiver_ssl.html"
|
5
6
|
end
|
6
7
|
end
|
7
8
|
|
8
9
|
|
9
|
-
end
|
10
|
+
end
|
data/init.rb
CHANGED
data/lib/facebooker/parser.rb
CHANGED
@@ -77,6 +77,10 @@ module Facebooker
|
|
77
77
|
end #do |hash, child|
|
78
78
|
end
|
79
79
|
|
80
|
+
def self.booleanize(response)
|
81
|
+
response == "1" ? true : false
|
82
|
+
end
|
83
|
+
|
80
84
|
def self.anonymous_field_from(child, hash)
|
81
85
|
if child.name == 'anon'
|
82
86
|
(hash[child.name] || []) << child.text_value
|
@@ -85,6 +89,12 @@ module Facebooker
|
|
85
89
|
|
86
90
|
end
|
87
91
|
|
92
|
+
class RevokeAuthorization < Parser#:nodoc:
|
93
|
+
def self.process(data)
|
94
|
+
booleanize(data)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
88
98
|
class CreateToken < Parser#:nodoc:
|
89
99
|
def self.process(data)
|
90
100
|
element('auth_createToken_response', data).text_value
|
@@ -539,6 +549,7 @@ module Facebooker
|
|
539
549
|
|
540
550
|
class Parser
|
541
551
|
PARSERS = {
|
552
|
+
'facebook.auth.revokeAuthorization' => RevokeAuthorization,
|
542
553
|
'facebook.auth.createToken' => CreateToken,
|
543
554
|
'facebook.auth.getSession' => GetSession,
|
544
555
|
'facebook.connect.registerUsers' => RegisterUsers,
|
@@ -22,7 +22,11 @@ module Facebooker
|
|
22
22
|
options.merge!(required_features.pop.symbolize_keys)
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
if request.ssl?
|
26
|
+
init_string = "FB.Facebook.init('#{Facebooker.api_key}','/xd_receiver_ssl.html');"
|
27
|
+
else
|
28
|
+
init_string = "FB.Facebook.init('#{Facebooker.api_key}','/xd_receiver.html');"
|
29
|
+
end
|
26
30
|
unless required_features.blank?
|
27
31
|
init_string = <<-FBML
|
28
32
|
#{case options[:js]
|
data/lib/facebooker/version.rb
CHANGED
data/lib/facebooker.rb
CHANGED
@@ -25,7 +25,7 @@ module Facebooker
|
|
25
25
|
|
26
26
|
@facebooker_configuration = {}
|
27
27
|
@current_adapter = nil
|
28
|
-
@set_asset_host_to_callback_url =
|
28
|
+
@set_asset_host_to_callback_url = true
|
29
29
|
@path_prefix = nil
|
30
30
|
@use_curl = false
|
31
31
|
|
@@ -92,14 +92,7 @@ module Facebooker
|
|
92
92
|
current_adapter.is_for?(application_container)
|
93
93
|
end
|
94
94
|
|
95
|
-
|
96
|
-
@set_asset_host_to_callback_url=val
|
97
|
-
end
|
98
|
-
|
99
|
-
def set_asset_host_to_callback_url
|
100
|
-
@set_asset_host_to_callback_url || true
|
101
|
-
end
|
102
|
-
|
95
|
+
attr_accessor :set_asset_host_to_callback_url
|
103
96
|
attr_accessor :use_curl
|
104
97
|
alias :use_curl? :use_curl
|
105
98
|
|
@@ -960,7 +960,23 @@ class RailsHelperTest < Test::Unit::TestCase
|
|
960
960
|
def test_init_fb_connect_with_features
|
961
961
|
assert @h.init_fb_connect("XFBML").match(/XFBML/)
|
962
962
|
end
|
963
|
-
|
963
|
+
|
964
|
+
def test_init_fb_connect_receiver_path
|
965
|
+
assert @h.init_fb_connect.match(/xd_receiver.html/)
|
966
|
+
end
|
967
|
+
|
968
|
+
def test_init_fb_connect_receiver_path_ssl
|
969
|
+
@h.instance_eval do
|
970
|
+
def request
|
971
|
+
ssl_request = ActionController::TestRequest.new
|
972
|
+
ssl_request.stubs(:ssl?).returns(true)
|
973
|
+
ssl_request
|
974
|
+
end
|
975
|
+
end
|
976
|
+
|
977
|
+
assert @h.init_fb_connect.match(/xd_receiver_ssl.html/)
|
978
|
+
end
|
979
|
+
|
964
980
|
def test_init_fb_connect_with_features_and_body
|
965
981
|
@h.expects(:capture).returns("Body Content")
|
966
982
|
|
@@ -1005,6 +1021,21 @@ class RailsHelperTest < Test::Unit::TestCase
|
|
1005
1021
|
end
|
1006
1022
|
end
|
1007
1023
|
|
1024
|
+
def test_fb_connect_javascript_tag_ssl
|
1025
|
+
@h.instance_eval do
|
1026
|
+
def request
|
1027
|
+
ssl_request = ActionController::TestRequest.new
|
1028
|
+
ssl_request.stubs(:ssl?).returns(true)
|
1029
|
+
ssl_request
|
1030
|
+
end
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
silence_warnings do
|
1034
|
+
assert_equal "<script src=\"https://www.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php\" type=\"text/javascript\"></script>",
|
1035
|
+
@h.fb_connect_javascript_tag
|
1036
|
+
end
|
1037
|
+
end
|
1038
|
+
|
1008
1039
|
def test_fb_container
|
1009
1040
|
@h.expects(:capture).returns("Inner Stuff")
|
1010
1041
|
@h.fb_container(:condition=>"somejs") do
|
data/test/facebooker_test.rb
CHANGED
@@ -12,16 +12,24 @@ class TestFacebooker < Test::Unit::TestCase
|
|
12
12
|
@service = Facebooker::Service.new('http://apibase.com', '/api/path', @api_key)
|
13
13
|
@desktop_session.instance_variable_set("@service", @service)
|
14
14
|
end
|
15
|
-
|
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
|
+
|
16
24
|
def test_session_must_be_created_from_api_key_and_secret_key
|
17
25
|
assert_kind_of(Facebooker::Session, @session)
|
18
26
|
end
|
19
|
-
|
27
|
+
|
20
28
|
def test_session_can_tell_you_its_login_url
|
21
29
|
assert_not_nil(@session.login_url)
|
22
30
|
assert_equal("http://www.facebook.com/login.php?api_key=#{@api_key}&v=1.0", @session.login_url)
|
23
31
|
end
|
24
|
-
|
32
|
+
|
25
33
|
def test_desktop_session_returns_auth_toke_as_part_of_login_url
|
26
34
|
@service = flexmock(@service).should_receive(:post).at_least.once.and_return(123)
|
27
35
|
assert_kind_of(Facebooker::Session::Desktop, @desktop_session)
|
@@ -36,10 +44,10 @@ class TestFacebooker < Test::Unit::TestCase
|
|
36
44
|
# def test_serivce_post_file_delegates_to_post_multipart_form
|
37
45
|
# # flexmock(@service).should_receive(:url).and_return('url')
|
38
46
|
# # flexmock(Net::HTTP).expects(:post_multipart_form).with('url', {:method => 'facebook.auth.createToken'}).returns(example_auth_token_xml)
|
39
|
-
#
|
47
|
+
#
|
40
48
|
# res = mock(:content_type => 'text/html', :code => '200', :body => '<html><body>my blog</body></html>')
|
41
49
|
# Net::HTTP.stubs(:get_response).once.with(uri).returns res
|
42
|
-
#
|
50
|
+
#
|
43
51
|
# @service.post_file(:method => 'facebook.auth.createToken')
|
44
52
|
# end
|
45
53
|
|
@@ -64,22 +72,22 @@ class TestFacebooker < Test::Unit::TestCase
|
|
64
72
|
expect_http_posts_with_responses(example_friends_xml)
|
65
73
|
assert_equal([222333, 1240079], @session.user.friends.map{|friend| friend.id})
|
66
74
|
end
|
67
|
-
|
75
|
+
|
68
76
|
def test_can_get_current_users_friend_lists
|
69
77
|
expect_http_posts_with_responses(example_friend_lists_xml)
|
70
78
|
assert_equal([12089150545, 16361710545], @session.user.friend_lists.map{|friend_list| friend_list.flid})
|
71
79
|
end
|
72
|
-
|
80
|
+
|
73
81
|
def test_can_get_info_for_instance_of_user
|
74
82
|
populate_user_info
|
75
83
|
@session.user.first_name = "Dave"
|
76
84
|
end
|
77
|
-
|
85
|
+
|
78
86
|
def test_can_get_info_for_one_or_more_users
|
79
87
|
friends = populate_session_friends
|
80
88
|
friend = friends.detect{|f| f.id == 222333}
|
81
89
|
assert_equal('This field perpetuates the glorification of the ego. Also, it has a character limit.',
|
82
|
-
friend.about_me)
|
90
|
+
friend.about_me)
|
83
91
|
assert_equal('Facebook Developers', friend.affiliations.first.name)
|
84
92
|
assert_equal('Friendship', friend.meeting_for.first)
|
85
93
|
assert_equal('94303', friend.current_location.zip)
|
@@ -97,14 +105,14 @@ class TestFacebooker < Test::Unit::TestCase
|
|
97
105
|
assert_equal('I rule', friend.status.message)
|
98
106
|
assert_equal(nil, friend.hometown_location)
|
99
107
|
end
|
100
|
-
|
108
|
+
|
101
109
|
def test_can_handle_nil_data
|
102
110
|
friends = populate_session_friends_with_nil_data
|
103
111
|
friend = friends.detect{|f| f.id == 222333}
|
104
112
|
assert_equal(nil,friend.current_location)
|
105
|
-
assert_equal(nil,friend.pic)
|
113
|
+
assert_equal(nil,friend.pic)
|
106
114
|
end
|
107
|
-
|
115
|
+
|
108
116
|
def test_session_can_expire_on_server_and_client_handles_appropriately
|
109
117
|
expect_http_posts_with_responses(example_session_expired_error_response)
|
110
118
|
assert_raises(Facebooker::Session::SessionExpired) {
|
@@ -112,22 +120,22 @@ class TestFacebooker < Test::Unit::TestCase
|
|
112
120
|
}
|
113
121
|
end
|
114
122
|
|
115
|
-
|
123
|
+
|
116
124
|
def test_can_publish_story_to_users_feed
|
117
125
|
expect_http_posts_with_responses(example_publish_story_xml)
|
118
126
|
assert_nothing_raised {
|
119
127
|
assert(@session.user.publish_story((s = Facebooker::Feed::Story.new; s.title = 'o hai'; s.body = '4srsly'; s)))
|
120
128
|
}
|
121
129
|
end
|
122
|
-
|
123
|
-
|
130
|
+
|
131
|
+
|
124
132
|
def test_can_publish_action_to_users_feed
|
125
133
|
expect_http_posts_with_responses(example_publish_action_xml)
|
126
134
|
assert_nothing_raised {
|
127
135
|
assert(@session.user.publish_action((s = Facebooker::Feed::Action.new; s.title = 'o hai'; s.body = '4srsly'; s)))
|
128
136
|
}
|
129
137
|
end
|
130
|
-
|
138
|
+
|
131
139
|
def test_can_publish_templatized_action_to_users_feed
|
132
140
|
expect_http_posts_with_responses(example_publish_templatized_action_xml)
|
133
141
|
assert_nothing_raised {
|
@@ -136,7 +144,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
136
144
|
assert(@session.user.publish_templatized_action(action))
|
137
145
|
}
|
138
146
|
end
|
139
|
-
|
147
|
+
|
140
148
|
def test_can_publish_templatized_action_to_users_feed_with_params_as_string
|
141
149
|
json_data="{\"move\": \"punch\"}"
|
142
150
|
action = Facebooker::Feed::TemplatizedAction.new
|
@@ -144,7 +152,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
144
152
|
action.title_data=json_data
|
145
153
|
assert_equal action.to_params[:title_data],json_data
|
146
154
|
end
|
147
|
-
|
155
|
+
|
148
156
|
def test_can_publish_templatized_action_to_users_feed_with_params_as_hash
|
149
157
|
json_data="{\"move\": \"punch\"}"
|
150
158
|
hash={:move=>"punch"}
|
@@ -166,7 +174,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
166
174
|
assert_equal("0", @session.user.notifications.pokes.unread)
|
167
175
|
assert_equal("1", @session.user.notifications.shares.unread)
|
168
176
|
end
|
169
|
-
|
177
|
+
|
170
178
|
def test_can_send_notifications
|
171
179
|
expect_http_posts_with_responses(example_notifications_send_xml)
|
172
180
|
assert_nothing_raised {
|
@@ -187,13 +195,13 @@ class TestFacebooker < Test::Unit::TestCase
|
|
187
195
|
assert_equal('123,321', @session.send_email(user_ids, subject,text,fbml ))
|
188
196
|
}
|
189
197
|
end
|
190
|
-
|
198
|
+
|
191
199
|
def test_can_find_friends_who_have_installed_app
|
192
200
|
expect_http_posts_with_responses(example_app_users_xml)
|
193
201
|
assert_equal(2, @session.user.friends_with_this_app.size)
|
194
202
|
assert_equal([222333, 1240079], @session.user.friends_with_this_app.map{|f| f.id})
|
195
203
|
end
|
196
|
-
|
204
|
+
|
197
205
|
def test_when_marshaling_a_session_object_only_enough_data_to_stay_authenticated_is_stored
|
198
206
|
populate_session_friends
|
199
207
|
assert_equal(2, @session.user.friends.size)
|
@@ -203,7 +211,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
203
211
|
end
|
204
212
|
assert_nil(reloaded_session.user.instance_variable_get("@friends"))
|
205
213
|
end
|
206
|
-
|
214
|
+
|
207
215
|
def test_sessions_can_be_infinite_or_can_expire
|
208
216
|
establish_session
|
209
217
|
assert(@session.expired?, "Session with expiry time #{@session.instance_variable_get('@expires')} occurred in the past and should be expired.")
|
@@ -211,14 +219,14 @@ class TestFacebooker < Test::Unit::TestCase
|
|
211
219
|
assert(@session.infinite?)
|
212
220
|
assert(!@session.expired?)
|
213
221
|
end
|
214
|
-
|
222
|
+
|
215
223
|
def test_session_can_tell_you_if_it_has_been_secured
|
216
224
|
mock = flexmock(Net::HTTP).should_receive(:post_form).and_return(example_auth_token_xml).once.ordered(:posts)
|
217
225
|
mock.should_receive(:post_form).and_return(example_get_session_xml.sub(/1173309298/, (Time.now + 60).to_i.to_s)).once.ordered(:posts)
|
218
226
|
@session.secure!
|
219
227
|
assert(@session.secured?)
|
220
228
|
end
|
221
|
-
|
229
|
+
|
222
230
|
def test_can_get_photos_by_pids
|
223
231
|
expect_http_posts_with_responses(example_get_photo_xml)
|
224
232
|
photos = @session.get_photos([97503428461115590, 97503428461115573])
|
@@ -226,82 +234,82 @@ class TestFacebooker < Test::Unit::TestCase
|
|
226
234
|
assert_equal "Rooftop barbecues make me act funny", photos.first.caption
|
227
235
|
assert_equal 97503428461115590, photos[0].id
|
228
236
|
end
|
229
|
-
|
237
|
+
|
230
238
|
def test_can_get_photos_by_subject_and_album
|
231
239
|
expect_http_posts_with_responses(example_get_photo_xml)
|
232
240
|
photos = @session.get_photos(nil, 22701786, 97503428432802022 )
|
233
241
|
assert_equal '97503428432802022', photos.first.aid
|
234
242
|
end
|
235
|
-
|
243
|
+
|
236
244
|
def test_getting_photos_requires_arguments
|
237
245
|
mock_http = establish_session
|
238
246
|
assert_raise(ArgumentError) { @session.get_photos() }
|
239
247
|
end
|
240
|
-
|
248
|
+
|
241
249
|
def test_can_get_albums_for_user
|
242
250
|
expect_http_posts_with_responses(example_user_albums_xml)
|
243
251
|
assert_equal('Summertime is Best', @session.user.albums.first.name)
|
244
252
|
assert_equal(2, @session.user.albums.size)
|
245
253
|
end
|
246
|
-
|
254
|
+
|
247
255
|
def test_can_get_albums_by_album_ids
|
248
256
|
expect_http_posts_with_responses(example_user_albums_xml)
|
249
257
|
albums = @session.get_albums([97503428432802022, 97503428432797817] )
|
250
258
|
assert_equal('Summertime is Best', albums[0].name)
|
251
259
|
assert_equal('Bonofon\'s Recital', albums[1].name)
|
252
260
|
end
|
253
|
-
|
261
|
+
|
254
262
|
def test_can_create_album
|
255
263
|
expect_http_posts_with_responses(example_new_album_xml)
|
256
264
|
assert_equal "My Empty Album", @session.user.create_album(:name => "My Empty Album", :location => "Limboland").name
|
257
265
|
end
|
258
|
-
|
266
|
+
|
259
267
|
def test_can_upload_photo
|
260
268
|
mock_http = establish_session
|
261
269
|
mock_http.should_receive(:post_multipart_form).and_return(example_upload_photo_xml).once.ordered(:posts)
|
262
270
|
f = Net::HTTP::MultipartPostFile.new("image.jpg", "image/jpeg", "RAW DATA")
|
263
271
|
assert_equal "Under the sunset", @session.user.upload_photo(f).caption
|
264
272
|
end
|
265
|
-
|
273
|
+
|
266
274
|
def test_can_get_photo_tags
|
267
275
|
expect_http_posts_with_responses(example_photo_tags_xml)
|
268
276
|
assert_instance_of Facebooker::Tag, @session.get_tags(:pids => 97503428461115571 ).first
|
269
277
|
end
|
270
|
-
|
278
|
+
|
271
279
|
# TODO: how to test that tags were created properly? Response doesn't contain much
|
272
280
|
def test_can_tag_a_user_in_a_photo
|
273
281
|
expect_http_posts_with_responses(example_add_tag_xml)
|
274
282
|
assert !@session.add_tags(pid = 97503428461115571, x= 30.0, y = 62.5, tag_uid = 1234567890).nil?
|
275
283
|
end
|
276
|
-
|
284
|
+
|
277
285
|
def test_can_add_multiple_tags_to_photos
|
278
286
|
end
|
279
|
-
|
287
|
+
|
280
288
|
def test_can_get_coordinates_for_photo_tags
|
281
289
|
expect_http_posts_with_responses(example_photo_tags_xml)
|
282
290
|
tag = @session.get_tags([97503428461115571]).first
|
283
291
|
assert_equal ['65.4248', '16.8627'], tag.coordinates
|
284
292
|
end
|
285
|
-
|
293
|
+
|
286
294
|
def test_can_upload_video
|
287
295
|
mock_http = establish_session
|
288
296
|
mock_http.should_receive(:post_multipart_form).and_return(example_upload_video_xml).once
|
289
297
|
f = Net::HTTP::MultipartPostFile.new("party.mp4", "video/mpeg", "RAW DATA")
|
290
298
|
assert_equal "Some Epic", @session.user.upload_video(f).title
|
291
299
|
end
|
292
|
-
|
300
|
+
|
293
301
|
def test_can_get_app_profile_fbml_for_user
|
294
302
|
expect_http_posts_with_responses(example_get_fbml_xml)
|
295
303
|
assert_match(/My profile!/, @session.user.profile_fbml)
|
296
304
|
end
|
297
|
-
|
305
|
+
|
298
306
|
def test_can_set_app_profile_fbml_for_user
|
299
307
|
expect_http_posts_with_responses(example_set_fbml_xml)
|
300
308
|
assert_nothing_raised {
|
301
309
|
@session.user.profile_fbml = 'aha!'
|
302
310
|
}
|
303
311
|
end
|
304
|
-
|
312
|
+
|
305
313
|
def test_get_logged_in_user
|
306
314
|
expect_http_posts_with_responses(example_get_logged_in_user_xml)
|
307
315
|
assert_equal 1240077, @session.post('facebook.users.getLoggedInUser', :session_key => @session.session_key)
|
@@ -358,6 +366,16 @@ class TestFacebooker < Test::Unit::TestCase
|
|
358
366
|
@desktop_session.user.friends.first.profile_fbml = "O rly"
|
359
367
|
}
|
360
368
|
end
|
369
|
+
|
370
|
+
def test_revoke_authorization_true
|
371
|
+
expect_http_posts_with_responses(example_revoke_authorization_true)
|
372
|
+
assert_equal true, @session.post('facebook.auth.revokeAuthorization', :uid => 123)
|
373
|
+
end
|
374
|
+
|
375
|
+
def test_revoke_authorization_false
|
376
|
+
expect_http_posts_with_responses(example_revoke_authorization_false)
|
377
|
+
assert_equal false, @session.post('facebook.auth.revokeAuthorization', :uid => 123)
|
378
|
+
end
|
361
379
|
|
362
380
|
private
|
363
381
|
def populate_user_info
|
@@ -370,22 +388,22 @@ class TestFacebooker < Test::Unit::TestCase
|
|
370
388
|
expect_http_posts_with_responses(example_limited_user_info_xml)
|
371
389
|
@session.user.populate(:affiliations, :status, :meeting_for)
|
372
390
|
end
|
373
|
-
|
391
|
+
|
374
392
|
def populate_session_friends
|
375
393
|
expect_http_posts_with_responses(example_friends_xml, example_user_info_xml)
|
376
394
|
@session.user.friends!
|
377
395
|
end
|
378
|
-
|
396
|
+
|
379
397
|
def populate_session_friends_with_limited_fields
|
380
398
|
expect_http_posts_with_responses(example_friends_xml, example_limited_user_info_xml)
|
381
399
|
@session.user.friends!(:affiliations, :status, :meeting_for)
|
382
400
|
end
|
383
|
-
|
401
|
+
|
384
402
|
def populate_session_friends_with_nil_data
|
385
403
|
expect_http_posts_with_responses(example_friends_xml, example_nil_user_info_xml)
|
386
404
|
@session.user.friends!(:name, :current_location, :pic)
|
387
405
|
end
|
388
|
-
|
406
|
+
|
389
407
|
def sample_args_to_post
|
390
408
|
{:method=>"facebook.auth.createToken", :sig=>"18b3dc4f5258a63c0ad641eebd3e3930"}
|
391
409
|
end
|
@@ -403,7 +421,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
403
421
|
</pages_getInfo_response>
|
404
422
|
XML
|
405
423
|
end
|
406
|
-
|
424
|
+
|
407
425
|
def example_pages_is_admin_true_xml
|
408
426
|
<<-XML
|
409
427
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -449,10 +467,10 @@ class TestFacebooker < Test::Unit::TestCase
|
|
449
467
|
def example_set_fbml_xml
|
450
468
|
<<-XML
|
451
469
|
<?xml version="1.0" encoding="UTF-8"?>
|
452
|
-
<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>
|
470
|
+
<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>
|
453
471
|
XML
|
454
472
|
end
|
455
|
-
|
473
|
+
|
456
474
|
def example_get_fbml_xml
|
457
475
|
<<-XML
|
458
476
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -460,17 +478,17 @@ class TestFacebooker < Test::Unit::TestCase
|
|
460
478
|
<fb:if-is-own-profile>My profile!
|
461
479
|
<fb:else> Not my profile!</fb:else>
|
462
480
|
</fb:if-is-own-profile>
|
463
|
-
</profile_getFBML_response>
|
481
|
+
</profile_getFBML_response>
|
464
482
|
XML
|
465
483
|
end
|
466
|
-
|
484
|
+
|
467
485
|
def example_notifications_send_xml
|
468
486
|
<<-XML
|
469
487
|
<?xml version="1.0" encoding="UTF-8"?>
|
470
488
|
<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>
|
471
489
|
XML
|
472
|
-
end
|
473
|
-
|
490
|
+
end
|
491
|
+
|
474
492
|
def example_notifications_send_email_xml
|
475
493
|
<<-XML
|
476
494
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -481,10 +499,10 @@ class TestFacebooker < Test::Unit::TestCase
|
|
481
499
|
def example_request_send_xml
|
482
500
|
<<-XML
|
483
501
|
<?xml version="1.0" encoding="UTF-8"?>
|
484
|
-
<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>
|
502
|
+
<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>
|
485
503
|
XML
|
486
|
-
end
|
487
|
-
|
504
|
+
end
|
505
|
+
|
488
506
|
def example_notifications_get_xml
|
489
507
|
<<-XML
|
490
508
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -508,24 +526,24 @@ class TestFacebooker < Test::Unit::TestCase
|
|
508
526
|
</friend_requests>
|
509
527
|
<group_invites list="true"/>
|
510
528
|
<event_invites list="true"/>
|
511
|
-
</notifications_get_response>
|
529
|
+
</notifications_get_response>
|
512
530
|
XML
|
513
531
|
end
|
514
|
-
|
532
|
+
|
515
533
|
def example_publish_story_xml
|
516
534
|
<<-XML
|
517
535
|
<?xml version="1.0" encoding="UTF-8"?>
|
518
|
-
<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>
|
536
|
+
<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>
|
519
537
|
XML
|
520
538
|
end
|
521
|
-
|
539
|
+
|
522
540
|
def example_publish_action_xml
|
523
541
|
<<-XML
|
524
542
|
<?xml version="1.0" encoding="UTF-8"?>
|
525
|
-
<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>
|
543
|
+
<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>
|
526
544
|
XML
|
527
545
|
end
|
528
|
-
|
546
|
+
|
529
547
|
def example_publish_templatized_action_xml
|
530
548
|
<<-XML
|
531
549
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -558,7 +576,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
558
576
|
<status/>
|
559
577
|
<year/>
|
560
578
|
</affiliation>
|
561
|
-
</affiliations>
|
579
|
+
</affiliations>
|
562
580
|
<birthday>November 3</birthday>
|
563
581
|
<books>The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar</books>
|
564
582
|
<current_location>
|
@@ -642,9 +660,9 @@ class TestFacebooker < Test::Unit::TestCase
|
|
642
660
|
<user>
|
643
661
|
<uid>1240079</uid>
|
644
662
|
<about_me>I am here.</about_me>
|
645
|
-
<activities>Party.</activities>
|
663
|
+
<activities>Party.</activities>
|
646
664
|
</user>
|
647
|
-
</users_getInfo_response>
|
665
|
+
</users_getInfo_response>
|
648
666
|
XML
|
649
667
|
end
|
650
668
|
|
@@ -662,7 +680,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
662
680
|
<status/>
|
663
681
|
<year/>
|
664
682
|
</affiliation>
|
665
|
-
</affiliations>
|
683
|
+
</affiliations>
|
666
684
|
<meeting_for list="true">
|
667
685
|
<seeking>Friendship</seeking>
|
668
686
|
</meeting_for>
|
@@ -673,13 +691,13 @@ class TestFacebooker < Test::Unit::TestCase
|
|
673
691
|
</user>
|
674
692
|
<user>
|
675
693
|
<uid>1240079</uid>
|
676
|
-
<activities>Party.</activities>
|
694
|
+
<activities>Party.</activities>
|
677
695
|
</user>
|
678
|
-
</users_getInfo_response>
|
696
|
+
</users_getInfo_response>
|
679
697
|
XML
|
680
698
|
end
|
681
699
|
|
682
|
-
|
700
|
+
|
683
701
|
def example_nil_user_info_xml
|
684
702
|
<<-XML
|
685
703
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -690,11 +708,11 @@ class TestFacebooker < Test::Unit::TestCase
|
|
690
708
|
<current_location xsi:nil="true"/>
|
691
709
|
<pic xsi:nil="true"/>
|
692
710
|
</user>
|
693
|
-
</users_getInfo_response>
|
711
|
+
</users_getInfo_response>
|
694
712
|
XML
|
695
713
|
end
|
696
714
|
|
697
|
-
|
715
|
+
|
698
716
|
def example_friends_xml
|
699
717
|
<<-XML
|
700
718
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -704,7 +722,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
704
722
|
</friends_get_response>
|
705
723
|
XML
|
706
724
|
end
|
707
|
-
|
725
|
+
|
708
726
|
def example_friend_lists_xml
|
709
727
|
<<-XML
|
710
728
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -720,14 +738,14 @@ class TestFacebooker < Test::Unit::TestCase
|
|
720
738
|
</friends_getLists_response>
|
721
739
|
XML
|
722
740
|
end
|
723
|
-
|
741
|
+
|
724
742
|
def example_get_logged_in_user_xml
|
725
743
|
<<-XML
|
726
744
|
<?xml version="1.0" encoding="UTF-8"?>
|
727
|
-
<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>
|
745
|
+
<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>
|
728
746
|
XML
|
729
747
|
end
|
730
|
-
|
748
|
+
|
731
749
|
def example_invalid_api_key_error_response
|
732
750
|
<<-XML
|
733
751
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -752,10 +770,10 @@ class TestFacebooker < Test::Unit::TestCase
|
|
752
770
|
<value>1186088346.82142</value>
|
753
771
|
</arg>
|
754
772
|
</request_args>
|
755
|
-
</error_response>
|
773
|
+
</error_response>
|
756
774
|
XML
|
757
775
|
end
|
758
|
-
|
776
|
+
|
759
777
|
def example_session_expired_error_response
|
760
778
|
<<-XML
|
761
779
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -780,7 +798,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
780
798
|
<value>1186088346.82142</value>
|
781
799
|
</arg>
|
782
800
|
</request_args>
|
783
|
-
</error_response>
|
801
|
+
</error_response>
|
784
802
|
XML
|
785
803
|
end
|
786
804
|
|
@@ -790,10 +808,10 @@ class TestFacebooker < Test::Unit::TestCase
|
|
790
808
|
<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">
|
791
809
|
<uid>222333</uid>
|
792
810
|
<uid>1240079</uid>
|
793
|
-
</friends_getAppUsers_response>
|
811
|
+
</friends_getAppUsers_response>
|
794
812
|
XML
|
795
813
|
end
|
796
|
-
|
814
|
+
|
797
815
|
def example_user_albums_xml
|
798
816
|
<<-XML
|
799
817
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -825,7 +843,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
825
843
|
</photos_getAlbums_response>
|
826
844
|
XML
|
827
845
|
end
|
828
|
-
|
846
|
+
|
829
847
|
def example_upload_photo_xml
|
830
848
|
<<-XML
|
831
849
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -841,7 +859,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
841
859
|
</photos_upload_response>
|
842
860
|
XML
|
843
861
|
end
|
844
|
-
|
862
|
+
|
845
863
|
def example_new_album_xml
|
846
864
|
<<-XML
|
847
865
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -859,7 +877,7 @@ class TestFacebooker < Test::Unit::TestCase
|
|
859
877
|
</photos_createAlbum_response>
|
860
878
|
XML
|
861
879
|
end
|
862
|
-
|
880
|
+
|
863
881
|
def example_photo_tags_xml
|
864
882
|
<<-XML
|
865
883
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -873,14 +891,14 @@ class TestFacebooker < Test::Unit::TestCase
|
|
873
891
|
</photos_getTags_response>
|
874
892
|
XML
|
875
893
|
end
|
876
|
-
|
894
|
+
|
877
895
|
def example_add_tag_xml
|
878
896
|
<<-XML
|
879
897
|
<?xml version="1.0" encoding="UTF-8"?>
|
880
898
|
<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>
|
881
899
|
XML
|
882
900
|
end
|
883
|
-
|
901
|
+
|
884
902
|
def example_get_photo_xml
|
885
903
|
<<-XML
|
886
904
|
<?xml version="1.0" encoding="UTF-8"?>
|
@@ -910,10 +928,10 @@ class TestFacebooker < Test::Unit::TestCase
|
|
910
928
|
</photos_get_response>
|
911
929
|
XML
|
912
930
|
end
|
913
|
-
|
931
|
+
|
914
932
|
def example_upload_video_xml
|
915
933
|
<<-XML
|
916
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
934
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
917
935
|
<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">
|
918
936
|
<vid>15943367753</vid>
|
919
937
|
<title>Some Epic</title>
|
@@ -922,4 +940,12 @@ class TestFacebooker < Test::Unit::TestCase
|
|
922
940
|
</video_upload_response>
|
923
941
|
XML
|
924
942
|
end
|
943
|
+
|
944
|
+
def example_revoke_authorization_true
|
945
|
+
"1"
|
946
|
+
end
|
947
|
+
|
948
|
+
def example_revoke_authorization_false
|
949
|
+
"0"
|
950
|
+
end
|
925
951
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mmangino-facebooker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Fowler
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2009-04-
|
16
|
+
date: 2009-04-30 00:00:00 -07:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|