fbooker 1.0.53
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 +144 -0
- data/README.rdoc +113 -0
- data/Rakefile +94 -0
- data/TODO.rdoc +4 -0
- data/examples/desktop_login.rb +14 -0
- data/facebooker.gemspec +42 -0
- data/generators/facebook/facebook_generator.rb +14 -0
- data/generators/facebook/templates/config/facebooker.yml +49 -0
- data/generators/facebook/templates/public/javascripts/facebooker.js +332 -0
- data/generators/facebook_controller/USAGE +33 -0
- data/generators/facebook_controller/facebook_controller_generator.rb +40 -0
- data/generators/facebook_controller/templates/controller.rb +7 -0
- data/generators/facebook_controller/templates/functional_test.rb +11 -0
- data/generators/facebook_controller/templates/helper.rb +2 -0
- data/generators/facebook_controller/templates/view.fbml.erb +2 -0
- data/generators/facebook_controller/templates/view.html.erb +2 -0
- data/generators/facebook_publisher/facebook_publisher_generator.rb +14 -0
- data/generators/facebook_publisher/templates/create_facebook_templates.rb +15 -0
- data/generators/facebook_publisher/templates/publisher.rb +3 -0
- data/generators/facebook_scaffold/USAGE +27 -0
- data/generators/facebook_scaffold/facebook_scaffold_generator.rb +118 -0
- data/generators/facebook_scaffold/templates/controller.rb +93 -0
- data/generators/facebook_scaffold/templates/facebook_style.css +2579 -0
- data/generators/facebook_scaffold/templates/functional_test.rb +89 -0
- data/generators/facebook_scaffold/templates/helper.rb +2 -0
- data/generators/facebook_scaffold/templates/layout.fbml.erb +6 -0
- data/generators/facebook_scaffold/templates/layout.html.erb +17 -0
- data/generators/facebook_scaffold/templates/style.css +74 -0
- data/generators/facebook_scaffold/templates/view_edit.fbml.erb +13 -0
- data/generators/facebook_scaffold/templates/view_edit.html.erb +18 -0
- data/generators/facebook_scaffold/templates/view_index.fbml.erb +24 -0
- data/generators/facebook_scaffold/templates/view_index.html.erb +24 -0
- data/generators/facebook_scaffold/templates/view_new.fbml.erb +12 -0
- data/generators/facebook_scaffold/templates/view_new.html.erb +17 -0
- data/generators/facebook_scaffold/templates/view_show.fbml.erb +10 -0
- data/generators/facebook_scaffold/templates/view_show.html.erb +10 -0
- data/generators/publisher/publisher_generator.rb +14 -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 +26 -0
- data/install.rb +12 -0
- data/lib/facebooker.rb +252 -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 +13 -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/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/notifications.rb +17 -0
- data/lib/facebooker/models/page.rb +44 -0
- data/lib/facebooker/models/photo.rb +19 -0
- data/lib/facebooker/models/tag.rb +12 -0
- data/lib/facebooker/models/user.rb +552 -0
- data/lib/facebooker/models/video.rb +9 -0
- data/lib/facebooker/models/work_info.rb +10 -0
- data/lib/facebooker/parser.rb +717 -0
- data/lib/facebooker/rails/backwards_compatible_param_checks.rb +31 -0
- data/lib/facebooker/rails/controller.rb +353 -0
- data/lib/facebooker/rails/cucumber.rb +28 -0
- data/lib/facebooker/rails/cucumber/world.rb +40 -0
- data/lib/facebooker/rails/extensions/action_controller.rb +48 -0
- data/lib/facebooker/rails/extensions/rack_setup.rb +6 -0
- data/lib/facebooker/rails/extensions/routing.rb +15 -0
- data/lib/facebooker/rails/facebook_form_builder.rb +112 -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_helper.rb +192 -0
- data/lib/facebooker/rails/facebook_url_rewriting.rb +60 -0
- data/lib/facebooker/rails/helpers.rb +870 -0
- data/lib/facebooker/rails/helpers/fb_connect.rb +122 -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 +595 -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 +102 -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 +726 -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/tasks/facebooker.rake +18 -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 +41 -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 +46 -0
- data/test/facebooker/models/photo_test.rb +16 -0
- data/test/facebooker/models/user_test.rb +397 -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 +519 -0
- data/test/facebooker/rails_integration_test.rb +1511 -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 +951 -0
- data/test/net/http_multipart_post_test.rb +52 -0
- data/test/rack/facebook_test.rb +73 -0
- metadata +235 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
require 'logger'
|
3
|
+
|
4
|
+
class Facebooker::LoggingTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
Facebooker.logger = Logger.new(STDERR)
|
8
|
+
Facebooker::Logging.skip_api_logging=false
|
9
|
+
end
|
10
|
+
def teardown
|
11
|
+
Facebooker.logger = nil
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_does_not_crash_with_nil_logger
|
16
|
+
Facebooker.logger = nil
|
17
|
+
Facebooker::Logging.log_fb_api('sample.api.call',
|
18
|
+
{'param1' => true, 'param2' => 'value2'})
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_does_not_crash_outside_rails
|
22
|
+
flexmock(Facebooker.logger, :logger).should_receive(:info).once.with(String)
|
23
|
+
Facebooker::Logging.log_fb_api('sample.api.call',
|
24
|
+
{'param1' => true, 'param2' => 'value2'})
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_can_disable_logging
|
28
|
+
Facebooker::Logging.skip_api_logging = true
|
29
|
+
flexmock(Facebooker::Logging).should_receive(:log_info).never
|
30
|
+
Facebooker::Logging.log_fb_api('sample.api.call',
|
31
|
+
{'param1' => true, 'param2' => 'value2'})
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_plain_format
|
35
|
+
flexmock(Facebooker.logger, :logger).should_receive(:info).once.with(
|
36
|
+
'sample.api.call (0) param1 = true')
|
37
|
+
Facebooker::Logging.log_fb_api('sample.api.call',
|
38
|
+
{'param1' => true})
|
39
|
+
ensure
|
40
|
+
Facebooker.logger = nil
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
class Facebooker::MobileTest < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@session = Facebooker::Session.create('apikey', 'secretkey')
|
6
|
+
@user = Facebooker::User.new(1234, @session)
|
7
|
+
Facebooker.use_curl=false
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_can_send
|
11
|
+
expect_http_posts_with_responses(example_can_send_xml)
|
12
|
+
assert(@session.mobile.can_send(@user))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_send
|
16
|
+
expect_http_posts_with_responses(example_send_xml)
|
17
|
+
assert(@session.mobile.send(@user, "Some sort of message"))
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def example_can_send_xml
|
22
|
+
<<-XML
|
23
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
24
|
+
<sms_canSend_response
|
25
|
+
xmlns="http://api.facebook.com/1.0/"
|
26
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
27
|
+
xsi:schemaLocation="http://api.facebook.com/1.0/http://api.facebook.com/1.0/facebook.xsd">
|
28
|
+
0
|
29
|
+
</sms_canSend_response>
|
30
|
+
XML
|
31
|
+
end
|
32
|
+
|
33
|
+
def example_send_xml
|
34
|
+
<<-XML
|
35
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
36
|
+
<sms_send_response
|
37
|
+
xmlns="http://api.facebook.com/1.0/"
|
38
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
39
|
+
xsi:schemaLocation="http://api.facebook.com/1.0/http://api.facebook.com/1.0/facebook.xsd">
|
40
|
+
0
|
41
|
+
</sms_send_response>
|
42
|
+
XML
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
|
3
|
+
class Facebooker::ModelTest < Test::Unit::TestCase
|
4
|
+
|
5
|
+
class ComplexThing
|
6
|
+
include Facebooker::Model
|
7
|
+
attr_accessor :weight, :height
|
8
|
+
end
|
9
|
+
|
10
|
+
class Thing
|
11
|
+
include Facebooker::Model
|
12
|
+
attr_accessor :name, :job
|
13
|
+
hash_settable_accessor :complex_thing, ComplexThing
|
14
|
+
hash_settable_list_accessor :list_of_complex_things, ComplexThing
|
15
|
+
|
16
|
+
def initialize *args
|
17
|
+
@session = nil
|
18
|
+
super
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class PopulatingThing
|
23
|
+
include Facebooker::Model
|
24
|
+
populating_attr_accessor :first_name
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@first_name = nil
|
28
|
+
@populated = false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_can_instantiate_an_object_with_a_hash
|
33
|
+
h = {:name => "Blob", :job => "Monster"}
|
34
|
+
assert_equal("Blob", Thing.from_hash(h).name)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_ignores_non_model_keys
|
38
|
+
h = {:name => "Blob", :job => "Monster", :not_there=>true}
|
39
|
+
assert_equal("Blob", Thing.from_hash(h).name)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_logs_non_model_keys
|
43
|
+
flexmock(Facebooker::Logging).should_receive(:log_info)
|
44
|
+
h = {:name => "Blob", :job => "Monster", :not_there=>true}
|
45
|
+
Thing.from_hash(h)
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def test_if_no_hash_is_given_to_model_constructor_no_attributes_are_set
|
50
|
+
assert_nothing_raised {
|
51
|
+
t = Thing.new
|
52
|
+
assert_nil(t.name)
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_can_declare_hash_settable_attributes
|
57
|
+
t = Thing.new({})
|
58
|
+
t.complex_thing = {:weight => 123, :height => 5.4}
|
59
|
+
assert_equal(123, t.complex_thing.weight)
|
60
|
+
t.complex_thing = ComplexThing.new(:weight => 321)
|
61
|
+
assert_equal(321, t.complex_thing.weight)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_can_declare_attributes_which_are_settable_via_a_list_of_hashes
|
65
|
+
t = Thing.new
|
66
|
+
t.list_of_complex_things = [{:weight => 444, :height => 123.0}, {:weight => 222, :height => 321.1}]
|
67
|
+
assert_equal("123.0, 321.1", t.list_of_complex_things.map{|ct| ct.height.to_s}.sort.join(', '))
|
68
|
+
t.list_of_complex_things = [ComplexThing.new(:weight => 555), ComplexThing.new(:weight => 111)]
|
69
|
+
assert_equal("111, 555", t.list_of_complex_things.map{|ct| ct.weight.to_s}.sort.join(', '))
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_if_you_try_to_use_a_models_session_without_initializing_it_first_you_get_a_descriptive_error
|
73
|
+
t = Thing.new
|
74
|
+
assert_raises(Facebooker::Model::UnboundSessionException) {
|
75
|
+
t.session
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_populating_reader_will_call_populate_if_model_was_not_previously_populated
|
80
|
+
t = PopulatingThing.new
|
81
|
+
flexmock(t).should_receive(:populate).once
|
82
|
+
t.first_name
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_populating_reader_will_not_call_populate_if_model_was_previously_populated
|
86
|
+
t = PopulatingThing.new
|
87
|
+
flexmock(t).should_receive(:populated?).and_return(true)
|
88
|
+
flexmock(t).should_receive(:populate).never
|
89
|
+
t.first_name
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_attempting_to_access_a_populating_reader_will_raise_an_exception_if_populate_was_not_defined
|
93
|
+
t = PopulatingThing.new
|
94
|
+
assert_raises(NotImplementedError) {
|
95
|
+
t.first_name
|
96
|
+
}
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_populate_from_hash_e_should_call_a_setter_for_a_key
|
100
|
+
t = PopulatingThing.new
|
101
|
+
flexmock(t).should_receive('mykey=').with('a value')
|
102
|
+
t.populate_from_hash!({ :mykey => 'a value' })
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_populate_from_hash_e_should_call_a_setter_for_a_key_if_the_value_is_false
|
106
|
+
t = PopulatingThing.new
|
107
|
+
flexmock(t).should_receive('mykey=').with(false)
|
108
|
+
t.populate_from_hash!({ :mykey => false })
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_populate_from_hash_e_should_call_not_a_setter_for_a_key_if_the_value_is_nil
|
112
|
+
t = PopulatingThing.new
|
113
|
+
flexmock(t).should_receive('mykey=').never
|
114
|
+
t.populate_from_hash!({ :mykey => nil })
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_populate_from_hash_should_check_for_an_empty_hash
|
118
|
+
t = PopulatingThing.new
|
119
|
+
hash = {}
|
120
|
+
flexmock(hash).should_receive('empty?')
|
121
|
+
t.populate_from_hash!(hash)
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_populate_from_hash_should_check_for_a_nil_param
|
125
|
+
t = PopulatingThing.new
|
126
|
+
hash = nil
|
127
|
+
assert_nothing_raised do
|
128
|
+
t.populate_from_hash!(hash)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
|
+
|
3
|
+
class Facebooker::EventTest < Test::Unit::TestCase
|
4
|
+
def test_attendance_will_query_for_event_when_asked_for_full_event_object
|
5
|
+
session = flexmock("a session object")
|
6
|
+
eid = 123
|
7
|
+
attendance = Facebooker::Event::Attendance.new
|
8
|
+
attendance.eid = eid
|
9
|
+
attendance.session = session
|
10
|
+
event = Facebooker::Event.new
|
11
|
+
event.eid = eid
|
12
|
+
session.should_receive(:post).once.with('facebook.events.get', :eids => [eid]).and_return([{:eid => eid}])
|
13
|
+
assert_equal(123, attendance.event.eid)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
|
+
require 'active_support'
|
3
|
+
|
4
|
+
class Facebooker::PageTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_should_be_able_to_populate_with_photo_id_as_integer
|
7
|
+
p = Facebooker::Page.new(12345)
|
8
|
+
assert_equal(12345,p.page_id)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_should_be_ble_to_initialize_with_photo_id_as_string
|
12
|
+
p = Facebooker::Page.new("12345")
|
13
|
+
assert_equal("12345",p.page_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_should_be_able_to_initialize_with_hash
|
17
|
+
p = Facebooker::Page.new(:page_id=>12345,:name=>"test page")
|
18
|
+
assert_equal("test page",p.name)
|
19
|
+
assert_equal(12345,p.page_id)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_should_be_able_to_see_if_user_is_fan_with_id
|
23
|
+
Facebooker::Session.current.expects(:post).with("facebook.pages.isFan",:page_id=>12345,:uid=>12451752).returns(true)
|
24
|
+
p = Facebooker::Page.new(12345)
|
25
|
+
assert p.user_is_fan?(12451752)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_should_be_able_to_see_if_user_is_fan_with_user
|
29
|
+
Facebooker::Session.current.expects(:post).with("facebook.pages.isFan",:page_id=>12345,:uid=>12451752).returns(false)
|
30
|
+
p = Facebooker::Page.new(12345)
|
31
|
+
assert !p.user_is_fan?(Facebooker::User.new(12451752))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_should_be_able_to_see_if_user_is_admin_with_id
|
35
|
+
Facebooker::Session.current.expects(:post).with("facebook.pages.isAdmin",:page_id=>12345,:uid=>12451752).returns(false)
|
36
|
+
p = Facebooker::Page.new(12345)
|
37
|
+
assert !p.user_is_admin?(12451752)
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_should_be_able_to_see_if_user_is_admin_with_user
|
42
|
+
Facebooker::Session.current.expects(:post).with("facebook.pages.isAdmin",:page_id=>12345,:uid=>12451752).returns(true)
|
43
|
+
p = Facebooker::Page.new(12345)
|
44
|
+
assert p.user_is_admin?(Facebooker::User.new(12451752))
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
|
+
require 'active_support'
|
3
|
+
|
4
|
+
class Facebooker::UserTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def test_pid_should_be_treated_as_a_string
|
7
|
+
@photo = Facebooker::Photo.new(:pid=>"100000025509592_6801")
|
8
|
+
assert_equal("100000025509592_6801",@photo.pid)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_setting_id_should_also_use_new_method
|
12
|
+
@photo = Facebooker::Photo.new(:id=>"100000025509592_6801")
|
13
|
+
assert_equal("100000025509592_6801",@photo.id)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,397 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
|
2
|
+
require 'active_support'
|
3
|
+
|
4
|
+
class Facebooker::UserTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def setup
|
7
|
+
@session = Facebooker::Session.create('apikey', 'secretkey')
|
8
|
+
@user = Facebooker::User.new(1234, @session)
|
9
|
+
@other_user = Facebooker::User.new(4321, @session)
|
10
|
+
ENV['FACEBOOK_CANVAS_PATH'] ='facebook_app_name'
|
11
|
+
ENV['FACEBOOK_API_KEY'] = '1234567'
|
12
|
+
ENV['FACEBOOK_SECRET_KEY'] = '7654321'
|
13
|
+
|
14
|
+
@user.friends = [@other_user]
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_has_permission
|
18
|
+
expect_http_posts_with_responses(has_app_permission_response_xml)
|
19
|
+
assert @user.has_permission?("status_update")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_has_permissions
|
23
|
+
expect_http_posts_with_responses(has_app_permission_response_xml, has_app_permission_response_xml)
|
24
|
+
assert @user.has_permissions?(["status_update", "read_stream"])
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_can_ask_user_if_he_or_she_is_friends_with_another_user
|
28
|
+
assert(@user.friends_with?(@other_user))
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_can_ask_user_if_he_or_she_is_friends_with_another_user_by_user_id
|
32
|
+
assert(@user.friends_with?(@other_user.id))
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_does_not_query_facebook_for_uid
|
36
|
+
@session.expects(:post).never
|
37
|
+
assert_equal 1234, Facebooker::User.new(1234, @session).uid
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_uid_is_always_an_integer
|
41
|
+
assert_equal 1234, Facebooker::User.new(:uid => "1234").uid
|
42
|
+
assert_equal 1234, Facebooker::User.new(:id => "1234").uid
|
43
|
+
|
44
|
+
assert_equal 1234, Facebooker::User.new(:uid => "1234").id
|
45
|
+
assert_equal 1234, Facebooker::User.new(:id => "1234").id
|
46
|
+
|
47
|
+
assert_equal 1234, Facebooker::User.new(:uid => "1234").facebook_id
|
48
|
+
assert_equal 1234, Facebooker::User.new(:id => "1234").facebook_id
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_cast_to_friend_list_id_with_nil
|
52
|
+
assert_nil @user.cast_to_friend_list_id(nil)
|
53
|
+
end
|
54
|
+
def test_cast_to_friend_list_id_with_integer
|
55
|
+
assert_equal 14,@user.cast_to_friend_list_id(14)
|
56
|
+
end
|
57
|
+
def test_cast_to_friend_list_id_with_string
|
58
|
+
@user.expects(:friend_lists).returns([Facebooker::FriendList.new(:flid=>199,:name=>"Work")])
|
59
|
+
assert_equal 199,@user.cast_to_friend_list_id("Work")
|
60
|
+
end
|
61
|
+
def test_cast_to_friend_list_id_with_friend_list
|
62
|
+
assert_equal 199,@user.cast_to_friend_list_id(Facebooker::FriendList.new(:flid=>199,:name=>"Work"))
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_cast_to_friend_list_id_with_invalid_string_raises
|
66
|
+
@user.expects(:friend_lists).returns([Facebooker::FriendList.new(:flid=>1,:name=>"Not Picked")])
|
67
|
+
assert_nil @user.cast_to_friend_list_id("Something")
|
68
|
+
fail("No exception raised, Expected Facebooker::Session::InvalidFriendList")
|
69
|
+
rescue Facebooker::Session::InvalidFriendList
|
70
|
+
nil
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_can_create_from_current_session
|
74
|
+
Facebooker::Session.expects(:current).returns("current")
|
75
|
+
user=Facebooker::User.new(1)
|
76
|
+
assert_equal("current",user.session)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_raises_when_no_session_bound
|
80
|
+
assert_raises(Facebooker::Model::UnboundSessionException) { Facebooker::User.new(1, nil).populate }
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_can_set_mobile_fbml
|
84
|
+
@user.expects(:set_profile_fbml).with(nil,"test",nil,nil)
|
85
|
+
@user.mobile_fbml="test"
|
86
|
+
end
|
87
|
+
def test_can_set_profile_action
|
88
|
+
@user.expects(:set_profile_fbml).with(nil,nil,"test",nil)
|
89
|
+
@user.profile_action="test"
|
90
|
+
end
|
91
|
+
def test_can_set_profile_fbml
|
92
|
+
@user.expects(:set_profile_fbml).with("test",nil,nil,nil)
|
93
|
+
@user.profile_fbml="test"
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_can_set_profile_main
|
97
|
+
@user.expects(:set_profile_fbml).with(nil,nil,nil,"test")
|
98
|
+
@user.profile_main="test"
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
def test_can_call_get_status
|
103
|
+
@session.expects(:post).with('facebook.status.get', {:uid => 1234, :limit => 4}).returns([{ "time" => 1233804858, "source" => 6628568379, "message" => "my message rocks!", "status_id" => 61436484312, 'uid' => 1234 }])
|
104
|
+
st = @user.statuses( 4 )
|
105
|
+
assert_equal st.size, 1
|
106
|
+
assert_equal st.first.message, 'my message rocks!'
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_can_call_set_profile_fbml
|
110
|
+
@session.expects(:post).with('facebook.profile.setFBML', {:uid=>1234,:profile=>"profile",:profile_action=>"action",:mobile_profile=>"mobile"},false)
|
111
|
+
@user.set_profile_fbml("profile","mobile","action")
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_can_call_set_profile_fbml_with_profile_main
|
115
|
+
@session.expects(:post).with('facebook.profile.setFBML', {:uid=>1234,:profile=>"profile",:profile_action=>"action",:mobile_profile=>"mobile", :profile_main => 'profile_main'},false)
|
116
|
+
@user.set_profile_fbml("profile","mobile","action",'profile_main')
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_can_get_profile_photos
|
120
|
+
@user.expects(:profile_photos)
|
121
|
+
@user.profile_photos
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_can_set_cookie
|
125
|
+
@user.expects(:set_cookie).with('name', 'value')
|
126
|
+
@user.set_cookie('name', 'value')
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_can_get_cookies
|
130
|
+
@user.expects(:get_cookies).with('name')
|
131
|
+
@user.get_cookies('name')
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_get_profile_photos
|
135
|
+
@user = Facebooker::User.new(548871286, @session)
|
136
|
+
expect_http_posts_with_responses(example_profile_photos_get_xml)
|
137
|
+
photos = @user.profile_photos
|
138
|
+
assert_equal "2357384227378429949", photos.first.aid
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_prepare_publish_to_options_pass_only_neccessary_parameters
|
142
|
+
options = @user.prepare_publish_to_options(@user, {:message => 'Hey there', :action_links => [:text => 'Link', :href => 'http://example.com']})
|
143
|
+
assert_equal(options[:uid], @user.uid)
|
144
|
+
assert_equal(options[:target_id], @user.id)
|
145
|
+
assert_equal(options[:message], 'Hey there')
|
146
|
+
assert_nil(options[:attachment])
|
147
|
+
assert_equal(options[:action_links], [:text => 'Link', :href => 'http://example.com'].to_json )
|
148
|
+
end
|
149
|
+
def test_publish_to
|
150
|
+
@user = Facebooker::User.new(548871286, @session)
|
151
|
+
expect_http_posts_with_responses(example_profile_publish_to_get_xml)
|
152
|
+
@user.publish_to(@other_user, :message => 'i love you man')
|
153
|
+
end
|
154
|
+
def test_publish_to_converts_attachment_to_json
|
155
|
+
@user = Facebooker::User.new(548871286, @session)
|
156
|
+
@user.session.expects(:post).with("facebook.stream.publish",has_entry(:attachment=>instance_of(String)),false)
|
157
|
+
@user.publish_to(@other_user, :message => 'i love you man',:attachment=>{:a=>"b"})
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_comment_on
|
161
|
+
@user = Facebooker::User.new(548871286, @session)
|
162
|
+
expect_http_posts_with_responses(example_comment_on_response)
|
163
|
+
assert_equal('703826862_78463536863', @user.comment_on('703826862_78463536862', :message => 'that was hilarious!'))
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_can_send_email
|
167
|
+
@user.expects(:send_email).with("subject", "body text")
|
168
|
+
@user.send_email("subject", "body text")
|
169
|
+
|
170
|
+
@user.expects(:send_email).with("subject", nil, "body fbml")
|
171
|
+
@user.send_email("subject", nil, "body fbml")
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_doesnt_post_to_facebook_when_assigning_status
|
175
|
+
@session.expects(:post).never
|
176
|
+
@user.status="my status"
|
177
|
+
end
|
178
|
+
def test_can_set_status_with_string
|
179
|
+
@session.expects(:post).with('facebook.users.setStatus', {:status=>"my status",:status_includes_verb=>1, :uid => @user.uid}, false)
|
180
|
+
@user.set_status("my status")
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_get_events
|
184
|
+
@user = Facebooker::User.new(9507801, @session)
|
185
|
+
expect_http_posts_with_responses(example_events_get_xml)
|
186
|
+
events = @user.events
|
187
|
+
assert_equal 29511517904, events.first.eid
|
188
|
+
end
|
189
|
+
|
190
|
+
def test_events_caching_honors_params
|
191
|
+
@user = Facebooker::User.new(9507801, @session)
|
192
|
+
@session.expects(:post).returns([{:eid=>1}])
|
193
|
+
assert_equal 1,@user.events.first.eid
|
194
|
+
@session.expects(:post).returns([{:eid=>2}])
|
195
|
+
assert_equal 2,@user.events(:start_time=>1.day.ago).first.eid
|
196
|
+
@session.expects(:post).never
|
197
|
+
assert_equal 1,@user.events.first.eid
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
def test_to_s
|
202
|
+
assert_equal("1234",@user.to_s)
|
203
|
+
end
|
204
|
+
|
205
|
+
def test_equality_with_same_id
|
206
|
+
assert_equal @user, @user.dup
|
207
|
+
assert_equal @user, Facebooker::User.new(:id => @user.id)
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_not_equal_to_differnt_class
|
211
|
+
assert_not_equal @user, flexmock(:id => @user.id)
|
212
|
+
end
|
213
|
+
|
214
|
+
def test_hash_email
|
215
|
+
assert_equal "4228600737_c96da02bba97aedfd26136e980ae3761", Facebooker::User.hash_email("mary@example.com")
|
216
|
+
end
|
217
|
+
def test_hash_email_not_normalized
|
218
|
+
assert_equal "4228600737_c96da02bba97aedfd26136e980ae3761", Facebooker::User.hash_email(" MaRy@example.com ")
|
219
|
+
end
|
220
|
+
|
221
|
+
def test_register_with_array
|
222
|
+
expect_http_posts_with_responses(register_response_xml)
|
223
|
+
assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.register([{:email=>"mary@example.com",:account_id=>1}])
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_unregister_with_array
|
227
|
+
expect_http_posts_with_responses(unregister_response_xml)
|
228
|
+
assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.unregister(["4228600737_c96da02bba97aedfd26136e980ae3761"])
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_unregister_emails_with_array
|
232
|
+
expect_http_posts_with_responses(unregister_response_xml)
|
233
|
+
assert_equal ["mary@example.com"],Facebooker::User.unregister_emails(["mary@example.com"])
|
234
|
+
end
|
235
|
+
|
236
|
+
def test_register_with_array_raises_if_not_all_success
|
237
|
+
expect_http_posts_with_responses(register_response_xml)
|
238
|
+
assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.register([{:email=>"mary@example.com",:account_id=>1},{:email=>"mike@example.com",:account_id=>2}])
|
239
|
+
fail "Should have raised Facebooker::Session::UserRegistrationFailed"
|
240
|
+
rescue Facebooker::Session::UserRegistrationFailed => e
|
241
|
+
assert_equal({:email=>"mike@example.com",:account_id=>2},e.failed_users.first)
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_unregister_with_array_raises_if_not_all_success
|
245
|
+
expect_http_posts_with_responses(unregister_response_xml)
|
246
|
+
assert_equal ["4228600737_c96da02bba97aedfd26136e980ae3761"],Facebooker::User.unregister(["4228600737_c96da02bba97aedfd26136e980ae3761","3587916587_791214eb452bf4de30e957d65a0234d4"])
|
247
|
+
fail "Should have raised Facebooker::Session::UserUnRegistrationFailed"
|
248
|
+
rescue Facebooker::Session::UserUnRegistrationFailed => e
|
249
|
+
assert_equal("3587916587_791214eb452bf4de30e957d65a0234d4",e.failed_users.first)
|
250
|
+
end
|
251
|
+
|
252
|
+
def test_unregister_emails_with_array_raises_if_not_all_success
|
253
|
+
expect_http_posts_with_responses(unregister_response_xml)
|
254
|
+
assert_equal ["mary@example.com"],Facebooker::User.unregister_emails(["mary@example.com","mike@example.com"])
|
255
|
+
fail "Should have raised Facebooker::Session::UserUnRegistrationFailed"
|
256
|
+
rescue Facebooker::Session::UserUnRegistrationFailed => e
|
257
|
+
assert_equal("mike@example.com",e.failed_users.first)
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
def test_get_locale
|
262
|
+
@user = Facebooker::User.new(9507801, @session)
|
263
|
+
expect_http_posts_with_responses(example_users_get_info_xml)
|
264
|
+
assert_equal "en_US", @user.locale
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_get_profile_url
|
268
|
+
@user = Facebooker::User.new(8055, @session)
|
269
|
+
expect_http_posts_with_responses(example_users_get_info_xml)
|
270
|
+
assert_equal "http://www.facebook.com/profile.php?id=8055", @user.profile_url
|
271
|
+
end
|
272
|
+
|
273
|
+
def test_can_rsvp_to_event
|
274
|
+
expect_http_posts_with_responses(example_events_rsvp_xml)
|
275
|
+
result = @user.rsvp_event(1000, 'attending')
|
276
|
+
assert result
|
277
|
+
end
|
278
|
+
|
279
|
+
private
|
280
|
+
def example_profile_photos_get_xml
|
281
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
282
|
+
<photos_get_response xmlns=\"http://api.facebook.com/1.0/\"
|
283
|
+
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
|
284
|
+
xsi:schemaLocation=\"http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd\" list=\"true\">
|
285
|
+
<photo>
|
286
|
+
<pid>34585991612804</pid>
|
287
|
+
<aid>2357384227378429949</aid>
|
288
|
+
<owner>1240077</owner>
|
289
|
+
<src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043524_2020.jpg</src>
|
290
|
+
<src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043524_2020.jpg</src_big>
|
291
|
+
<src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043524_2020.jpg</src_small>
|
292
|
+
<link>http://www.facebook.com/photo.php?pid=30043524&id=8055</link>
|
293
|
+
<caption>From The Deathmatch (Trailer) (1999)</caption>
|
294
|
+
<created>1132553361</created>
|
295
|
+
</photo>
|
296
|
+
<photo>
|
297
|
+
<pid>34585991612805</pid>
|
298
|
+
<aid>2357384227378429949</aid>
|
299
|
+
<owner>1240077</owner>
|
300
|
+
<src>http://ip002.facebook.com/v11/135/18/8055/s1240077_30043525_2184.jpg</src>
|
301
|
+
<src_big>http://ip002.facebook.com/v11/135/18/8055/n1240077_30043525_2184.jpg</src_big>
|
302
|
+
<src_small>http://ip002.facebook.com/v11/135/18/8055/t1240077_30043525_2184.jpg</src_small>
|
303
|
+
<link>http://www.facebook.com/photo.php?pid=30043525&id=8055</link>
|
304
|
+
<caption>Mexico City, back cover of the CYHS Student Underground 1999.</caption>
|
305
|
+
<created>1132553362</created>
|
306
|
+
</photo>
|
307
|
+
</photos_get_response>"
|
308
|
+
end
|
309
|
+
|
310
|
+
def example_events_get_xml
|
311
|
+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
312
|
+
<events_get_response xmlns=\"http://api.facebook.com/1.0/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd\" list=\"true\">
|
313
|
+
<event>
|
314
|
+
<eid>29511517904</eid>
|
315
|
+
<name>PUMA SALE</name>
|
316
|
+
<tagline/>
|
317
|
+
<nid>0</nid>
|
318
|
+
<pic>http://profile.ak.facebook.com/object3/370/66/s29511517904_6952.jpg</pic>
|
319
|
+
<pic_big>http://profile.ak.facebook.com/object3/370/66/n29511517904_6952.jpg</pic_big>
|
320
|
+
<pic_small>http://profile.ak.facebook.com/object3/370/66/t29511517904_6952.jpg</pic_small>
|
321
|
+
<host>PUMA</host>
|
322
|
+
<description>PUMA SALE</description>
|
323
|
+
<event_type>Education</event_type>
|
324
|
+
<event_subtype>Study Group</event_subtype>
|
325
|
+
<start_time>1212166800</start_time>
|
326
|
+
<end_time>1212364800</end_time>
|
327
|
+
<creator>1234261165</creator>
|
328
|
+
<update_time>1209768148</update_time>
|
329
|
+
<location>PUMA LOT</location>
|
330
|
+
<venue>
|
331
|
+
<street>5 LYBERTY WAY</street>
|
332
|
+
<city>Westford</city>
|
333
|
+
<state>Massachusetts</state>
|
334
|
+
<country>United States</country>
|
335
|
+
<latitude>42.5792</latitude>
|
336
|
+
<longitude>-71.4383</longitude>
|
337
|
+
</venue>
|
338
|
+
</event>
|
339
|
+
</events_get_response>"
|
340
|
+
end
|
341
|
+
|
342
|
+
def example_users_get_info_xml
|
343
|
+
<<-XML
|
344
|
+
<?xml version="1.0" encoding="UTF-8"?> <users_getInfo_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd" list="true"> <user> <uid>8055</uid> <about_me>This field perpetuates the glorification of the ego. Also, it has a character limit.</about_me> <activities>Here: facebook, etc. There: Glee Club, a capella, teaching.</activities> <affiliations list="true"> <affiliation> <nid>50453093</nid> <name>Facebook Developers</name> <type>work</type> <status/> <year/> </affiliation> </affiliations> <birthday>November 3</birthday> <books>The Brothers K, GEB, Ken Wilber, Zen and the Art, Fitzgerald, The Emporer's New Mind, The Wonderful Story of Henry Sugar</books> <current_location> <city>Palo Alto</city> <state>CA</state> <country>United States</country> <zip>94303</zip> </current_location> <education_history list="true"> <education_info> <name>Harvard</name> <year>2003</year> <concentrations list="true"> <concentration>Applied Mathematics</concentration> <concentration>Computer Science</concentration> </concentrations> </education_info> </education_history> <first_name>Dave</first_name> <hometown_location> <city>York</city> <state>PA</state> <country>United States</country> </hometown_location> <hs_info> <hs1_name>Central York High School</hs1_name> <hs2_name/> <grad_year>1999</grad_year> <hs1_id>21846</hs1_id> <hs2_id>0</hs2_id> </hs_info> <is_app_user>1</is_app_user> <has_added_app>1</has_added_app> <interests>coffee, computers, the funny, architecture, code breaking,snowboarding, philosophy, soccer, talking to strangers</interests> <last_name>Fetterman</last_name> <locale>en_US</locale> <meeting_for list="true"> <seeking>Friendship</seeking> </meeting_for> <meeting_sex list="true"> <sex>female</sex> </meeting_sex> <movies>Tommy Boy, Billy Madison, Fight Club, Dirty Work, Meet the Parents, My Blue Heaven, Office Space </movies> <music>New Found Glory, Daft Punk, Weezer, The Crystal Method, Rage, the KLF, Green Day, Live, Coldplay, Panic at the Disco, Family Force 5</music> <name>Dave Fetterman</name> <notes_count>0</notes_count> <pic>http://photos-055.facebook.com/ip007/profile3/1271/65/s8055_39735.jpg</pic> <pic_big>http://photos-055.facebook.com/ip007/profile3/1271/65/n8055_39735.jpg</pic_big> <pic_small>http://photos-055.facebook.com/ip007/profile3/1271/65/t8055_39735.jpg</pic_small> <pic_square>http://photos-055.facebook.com/ip007/profile3/1271/65/q8055_39735.jpg</pic_square> <political>Moderate</political> <profile_update_time>1170414620</profile_update_time> <profile_url>http://www.facebook.com/profile.php?id=8055</profile_url> <quotes/> <relationship_status>In a Relationship</relationship_status> <religion/> <sex>male</sex> <significant_other_id xsi:nil="true"/> <status> <message>Fast Company, November issue, page 84</message> <time>1193075616</time> </status> <timezone>-8</timezone> <tv>cf. Bob Trahan</tv> <wall_count>121</wall_count> <work_history list="true"> <work_info> <location> <city>Palo Alto</city> <state>CA</state> <country>United States</country> </location> <company_name>Facebook</company_name> <position>Software Engineer</position> <description>Tech Lead, Facebook Platform</description> <start_date>2006-01</start_date> <end_date/> </work_info> </work_history> </user> </users_getInfo_response>
|
345
|
+
XML
|
346
|
+
end
|
347
|
+
|
348
|
+
def register_response_xml
|
349
|
+
<<-XML
|
350
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
351
|
+
<connect_registerUsers_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/facebook.xsd" list="true">
|
352
|
+
<connect_registerUsers_response_elt>4228600737_c96da02bba97aedfd26136e980ae3761</connect_registerUsers_response_elt>
|
353
|
+
</connect_registerUsers_response>
|
354
|
+
XML
|
355
|
+
end
|
356
|
+
|
357
|
+
def unregister_response_xml
|
358
|
+
<<-XML
|
359
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
360
|
+
<connect_unregisterUsers_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/facebook.xsd" list="true">
|
361
|
+
<connect_unregisterUsers_response_elt>4228600737_c96da02bba97aedfd26136e980ae3761</connect_unregisterUsers_response_elt>
|
362
|
+
</connect_unregisterUsers_response>
|
363
|
+
XML
|
364
|
+
end
|
365
|
+
|
366
|
+
def has_app_permission_response_xml
|
367
|
+
<<-XML
|
368
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
369
|
+
<users_hasAppPermission_response xmlns="http://api.facebook.com/1.0/"
|
370
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
371
|
+
xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1</users_hasAppPermission_response>
|
372
|
+
XML
|
373
|
+
end
|
374
|
+
|
375
|
+
def example_profile_publish_to_get_xml
|
376
|
+
<<-eoxml
|
377
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
378
|
+
<stream_publish_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">703826862_78463536862</stream_publish_response>
|
379
|
+
eoxml
|
380
|
+
end
|
381
|
+
|
382
|
+
def example_comment_on_response
|
383
|
+
<<-eoxml
|
384
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
385
|
+
<stream_addComment_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">703826862_78463536863</stream_addComment_response>
|
386
|
+
eoxml
|
387
|
+
end
|
388
|
+
|
389
|
+
def example_events_rsvp_xml
|
390
|
+
<<-E
|
391
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
392
|
+
<events_rsvp_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
393
|
+
xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">1
|
394
|
+
</events_rsvp_response>
|
395
|
+
E
|
396
|
+
end
|
397
|
+
end
|