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,33 @@
|
|
1
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
2
|
+
Content-Disposition: form-data; name="aid"
|
3
|
+
|
4
|
+
940915667462717
|
5
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
6
|
+
Content-Disposition: form-data; name="api_key"
|
7
|
+
|
8
|
+
77a52842357422fadd912a2600e6e53c
|
9
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
10
|
+
Content-Disposition: form-data; name="call_id"
|
11
|
+
|
12
|
+
1172623588.023010
|
13
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
14
|
+
Content-Disposition: form-data; name="caption"
|
15
|
+
|
16
|
+
Under the sunset
|
17
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
18
|
+
Content-Disposition: form-data; name="method"
|
19
|
+
|
20
|
+
facebook.photos.upload
|
21
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
22
|
+
Content-Disposition: form-data; name="session_key"
|
23
|
+
|
24
|
+
489727d0ab2efc6e8003018c-i2LLkn8BDb2s.
|
25
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
26
|
+
Content-Disposition: form-data; name="sig"
|
27
|
+
|
28
|
+
dfa724b8a5cd97d9df4baf2b60d3484c
|
29
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
30
|
+
Content-Disposition: form-data; name="v"
|
31
|
+
|
32
|
+
1.0
|
33
|
+
--MichaelNiessnerIsSuperDuperAwesome--
|
@@ -0,0 +1,38 @@
|
|
1
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
2
|
+
Content-Disposition: form-data; name="aid"
|
3
|
+
|
4
|
+
940915667462717
|
5
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
6
|
+
Content-Disposition: form-data; name="api_key"
|
7
|
+
|
8
|
+
77a52842357422fadd912a2600e6e53c
|
9
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
10
|
+
Content-Disposition: form-data; name="call_id"
|
11
|
+
|
12
|
+
1172623588.023010
|
13
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
14
|
+
Content-Disposition: form-data; name="caption"
|
15
|
+
|
16
|
+
Under the sunset
|
17
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
18
|
+
Content-Disposition: form-data; name="method"
|
19
|
+
|
20
|
+
facebook.photos.upload
|
21
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
22
|
+
Content-Disposition: form-data; name="session_key"
|
23
|
+
|
24
|
+
489727d0ab2efc6e8003018c-i2LLkn8BDb2s.
|
25
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
26
|
+
Content-Disposition: form-data; name="sig"
|
27
|
+
|
28
|
+
dfa724b8a5cd97d9df4baf2b60d3484c
|
29
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
30
|
+
Content-Disposition: form-data; name="v"
|
31
|
+
|
32
|
+
1.0
|
33
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
34
|
+
Content-Disposition: form-data; name="file"; filename="somefilename.jpg"
|
35
|
+
Content-Type: image/jpg
|
36
|
+
|
37
|
+
[Raw file data here]
|
38
|
+
--MichaelNiessnerIsSuperDuperAwesome--
|
@@ -0,0 +1,38 @@
|
|
1
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
2
|
+
Content-Disposition: form-data; name="aid"
|
3
|
+
|
4
|
+
940915667462717
|
5
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
6
|
+
Content-Disposition: form-data; name="api_key"
|
7
|
+
|
8
|
+
77a52842357422fadd912a2600e6e53c
|
9
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
10
|
+
Content-Disposition: form-data; name="call_id"
|
11
|
+
|
12
|
+
1172623588.023010
|
13
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
14
|
+
Content-Disposition: form-data; name="caption"
|
15
|
+
|
16
|
+
Under the sunset
|
17
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
18
|
+
Content-Disposition: form-data; name="method"
|
19
|
+
|
20
|
+
facebook.photos.upload
|
21
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
22
|
+
Content-Disposition: form-data; name="session_key"
|
23
|
+
|
24
|
+
489727d0ab2efc6e8003018c-i2LLkn8BDb2s.
|
25
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
26
|
+
Content-Disposition: form-data; name="sig"
|
27
|
+
|
28
|
+
dfa724b8a5cd97d9df4baf2b60d3484c
|
29
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
30
|
+
Content-Disposition: form-data; name="v"
|
31
|
+
|
32
|
+
1.0
|
33
|
+
--MichaelNiessnerIsSuperDuperAwesome
|
34
|
+
Content-Disposition: form-data; filename="somefilename.jpg"
|
35
|
+
Content-Type: image/jpg
|
36
|
+
|
37
|
+
[Raw file data here]
|
38
|
+
--MichaelNiessnerIsSuperDuperAwesome--
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
require 'net/http_multipart_post'
|
3
|
+
|
4
|
+
class HttpMulitpartPostTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def fixture(string)
|
10
|
+
File.open(File.dirname(__FILE__) + "/../fixtures/#{string}.txt").read
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_multipart_post_with_only_parameters
|
14
|
+
params = add_sample_facebook_params({})
|
15
|
+
post = Net::HTTP::MultipartPost.new("uri", params)
|
16
|
+
assert_equal fixture("multipart_post_body_with_only_parameters"), post.send(:body)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_multipart_post_with_a_single_file
|
20
|
+
params = add_sample_facebook_params({})
|
21
|
+
params[:file] = Net::HTTP::MultipartPostFile.new
|
22
|
+
params[:file].filename = "somefilename.jpg"
|
23
|
+
params[:file].content_type = "image/jpg"
|
24
|
+
params[:file].data = "[Raw file data here]"
|
25
|
+
post = Net::HTTP::MultipartPost.new("uri", params)
|
26
|
+
assert_equal fixture("multipart_post_body_with_single_file"), post.send(:body)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_multipart_post_with_a_single_file_parameter_that_has_nil_key
|
30
|
+
params = add_sample_facebook_params({})
|
31
|
+
params[nil] = Net::HTTP::MultipartPostFile.new("somefilename.jpg", "image/jpg", "[Raw file data here]")
|
32
|
+
post = Net::HTTP::MultipartPost.new("uri", params)
|
33
|
+
assert_equal fixture("multipart_post_body_with_single_file_that_has_nil_key"), post.send(:body)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_multipart_post_should_have_correct_content_type
|
37
|
+
post = Net::HTTP::MultipartPost.new("uri", {})
|
38
|
+
assert post.send(:content_type) =~ /multipart\/form-data; boundary=/
|
39
|
+
end
|
40
|
+
|
41
|
+
def add_sample_facebook_params(hash)
|
42
|
+
hash[:method] = "facebook.photos.upload"
|
43
|
+
hash[:v] = "1.0"
|
44
|
+
hash[:api_key] = "77a52842357422fadd912a2600e6e53c"
|
45
|
+
hash[:session_key] = "489727d0ab2efc6e8003018c-i2LLkn8BDb2s."
|
46
|
+
hash[:call_id] = "1172623588.023010"
|
47
|
+
hash[:caption] = "Under the sunset"
|
48
|
+
hash[:aid] = "940915667462717"
|
49
|
+
hash[:sig] = "dfa724b8a5cd97d9df4baf2b60d3484c"
|
50
|
+
hash
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
require 'rack/facebook_session'
|
3
|
+
require 'rack/lint'
|
4
|
+
require 'rack/mock'
|
5
|
+
|
6
|
+
class Rack::FacebookSessionTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@app = lambda do |env|
|
10
|
+
@env = env
|
11
|
+
Rack::Response.new().to_a
|
12
|
+
end
|
13
|
+
|
14
|
+
@facebook = Rack::FacebookSession.new(@app, '_top_sekrit')
|
15
|
+
end
|
16
|
+
|
17
|
+
def params(p)
|
18
|
+
p.map{|*args| args.join('=') }.join('&')
|
19
|
+
end
|
20
|
+
|
21
|
+
def app
|
22
|
+
Rack::MockRequest.new(Rack::Lint.new(@facebook))
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_converts_session_key_on_get
|
26
|
+
response = app.get '/', :input => params(:fb_sig_session_key => 'foo')
|
27
|
+
assert_equal '_top_sekrit=foo', @env['HTTP_COOKIE']
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_converts_session_key_on_post
|
31
|
+
response = app.post '/', :input => params(:fb_sig_session_key => 'foo')
|
32
|
+
assert_equal '_top_sekrit=foo', @env['HTTP_COOKIE']
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
+
require 'rack/facebook'
|
3
|
+
require 'rack/lint'
|
4
|
+
require 'rack/mock'
|
5
|
+
|
6
|
+
class Rack::FacebookTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
flexmock(Facebooker).should_receive(:secret_key).and_return('secret')
|
10
|
+
flexmock(Facebooker).should_receive(:load_adapter)
|
11
|
+
@app = lambda do |env|
|
12
|
+
@env = env
|
13
|
+
Rack::Response.new().to_a
|
14
|
+
end
|
15
|
+
@facebook = Rack::Facebook.new(@app)
|
16
|
+
@valid_params = {
|
17
|
+
:fb_sig_user => '1',
|
18
|
+
:fb_sig => 'ignored'
|
19
|
+
}
|
20
|
+
@page = Proc.new {|options|
|
21
|
+
options ||= @valid_params
|
22
|
+
app.post "/", :input => params(options)
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def params(p)
|
27
|
+
p.map{|*args| args.join('=') }.join('&')
|
28
|
+
end
|
29
|
+
|
30
|
+
def app
|
31
|
+
Rack::MockRequest.new(Rack::Lint.new(@facebook))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_without_fb_params
|
35
|
+
response = app.post("/")
|
36
|
+
assert_equal 200, response.status
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_converts_request_method
|
40
|
+
response = @page.call(:fb_sig_request_method => 'GET', :fb_sig => '4d2a700e90b0bcbe54b9e627d2cc1417')
|
41
|
+
assert_equal 200, response.status
|
42
|
+
assert_equal 'GET', @env['REQUEST_METHOD']
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_only_sets_request_method_if_provided
|
46
|
+
response = @page.call(:fb_sig_user => '1', :fb_sig => '313dd5caed3d0902d83225ff3ae9a950')
|
47
|
+
assert_equal 200, response.status
|
48
|
+
assert_equal 'POST', @env['REQUEST_METHOD']
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_renders_400_with_invalid_signature
|
52
|
+
response = @page.call(:fb_sig => 'wrong', :fb_sig_user => 1)
|
53
|
+
assert_equal 400, response.status
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_skips_with_false_condition
|
57
|
+
@facebook = Rack::Facebook.new(@app) { false }
|
58
|
+
response = @page.call({})
|
59
|
+
assert_equal 200, response.status
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_skips_with_true_condition_without_fb_sig
|
63
|
+
@facebook = Rack::Facebook.new(@app) { true }
|
64
|
+
response = @page.call(:fb_sig_user => 'ignored')
|
65
|
+
assert_equal 200, response.status
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_verifies_with_true_condition_with_fb_sig
|
69
|
+
@facebook = Rack::Facebook.new(@app) { true }
|
70
|
+
response = @page.call(:fb_sig => 'wrong', :fb_sig_user => 'ignored')
|
71
|
+
assert_equal 400, response.status
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/test_helper')
|
2
|
+
|
3
|
+
tmp = $-w
|
4
|
+
$-w = nil
|
5
|
+
require 'action_controller'
|
6
|
+
require 'action_controller/test_process'
|
7
|
+
require 'active_record'
|
8
|
+
$-w = tmp
|
9
|
+
gem 'rails'
|
10
|
+
require 'initializer'
|
11
|
+
require File.dirname(__FILE__)+'/../init'
|
12
|
+
require 'facebooker/rails/controller'
|
13
|
+
require 'facebooker/rails/helpers/stream_publish'
|
14
|
+
require 'facebooker/rails/helpers/fb_connect'
|
15
|
+
require 'facebooker/rails/helpers'
|
16
|
+
require 'facebooker/rails/publisher'
|
17
|
+
require 'facebooker/rails/facebook_form_builder'
|
18
|
+
|
19
|
+
if Rails.version >= '2.3'
|
20
|
+
Test::Unit::TestCase.send :include, ActionController::TestCase::Assertions
|
21
|
+
Test::Unit::TestCase.send :include, ActionController::TestProcess
|
22
|
+
Test::Unit::TestCase.send :include, Facebooker::Rails::TestHelpers
|
23
|
+
|
24
|
+
ActionController::Base.session = { :key => "9hfwfl8slgh9", :secret => "db08fcba0378a9e066ce037bec4b72bc" }
|
25
|
+
end
|
26
|
+
|
27
|
+
ActionController::Routing::Routes.draw do |map|
|
28
|
+
map.connect '', :controller=>"facebook",:conditions=>{:canvas=>true}
|
29
|
+
map.connect '', :controller=>"plain_old_rails"
|
30
|
+
map.resources :comments, :controller=>"plain_old_rails"
|
31
|
+
map.connect 'require_auth/:action', :controller => "controller_which_requires_facebook_authentication"
|
32
|
+
map.connect 'require_install/:action', :controller => "controller_which_requires_application_installation"
|
33
|
+
silence_warnings do
|
34
|
+
map.connect ':controller/:action/:id', :controller => "plain_old_rails"
|
35
|
+
end
|
36
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'rubygems'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'nokogiri'
|
6
|
+
rescue LoadError
|
7
|
+
# Should work without nokogiri
|
8
|
+
end
|
9
|
+
|
10
|
+
begin
|
11
|
+
require 'multi_rails_init'
|
12
|
+
rescue LoadError
|
13
|
+
# multi rails not installed, test against newest supported version of Rails
|
14
|
+
gem 'rails', '2.3.5'
|
15
|
+
end
|
16
|
+
require 'active_support'
|
17
|
+
require 'flexmock/test_unit'
|
18
|
+
require 'mocha'
|
19
|
+
|
20
|
+
$: << File.join(File.dirname(__FILE__), '..', 'lib')
|
21
|
+
|
22
|
+
rails_root = File.join(File.dirname(__FILE__),'..','..')
|
23
|
+
if defined? RAILS_ROOT
|
24
|
+
RAILS_ROOT.replace(rails_root)
|
25
|
+
else
|
26
|
+
RAILS_ROOT = rails_root
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'facebooker'
|
30
|
+
require 'facebooker/rails/test_helpers'
|
31
|
+
|
32
|
+
class Test::Unit::TestCase
|
33
|
+
|
34
|
+
include Facebooker::Rails::TestHelpers unless self.included_modules.include?( Facebooker::Rails::TestHelpers )
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def expect_http_posts_with_responses(*responses_xml)
|
39
|
+
mock_http = establish_session
|
40
|
+
responses_xml.each do |xml_string|
|
41
|
+
mock_http.should_receive(:post_form).and_return(xml_string).once.ordered(:posts)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def establish_session(session = @session)
|
46
|
+
mock = flexmock(Net::HTTP).should_receive(:post_form).and_return(example_auth_token_xml).once.ordered(:posts)
|
47
|
+
mock.should_receive(:post_form).and_return(example_get_session_xml).once.ordered(:posts)
|
48
|
+
session.secure!
|
49
|
+
mock
|
50
|
+
end
|
51
|
+
|
52
|
+
def example_auth_token_xml
|
53
|
+
<<-XML
|
54
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
55
|
+
<auth_createToken_response xmlns="http://api.facebook.com/1.0/"
|
56
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
57
|
+
xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
|
58
|
+
3e4a22bb2f5ed75114b0fc9995ea85f1
|
59
|
+
</auth_createToken_response>
|
60
|
+
XML
|
61
|
+
end
|
62
|
+
|
63
|
+
def example_get_session_xml
|
64
|
+
<<-XML
|
65
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
66
|
+
<auth_getSession_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">
|
67
|
+
<session_key>5f34e11bfb97c762e439e6a5-8055</session_key>
|
68
|
+
<uid>8055</uid>
|
69
|
+
<expires>1173309298</expires>
|
70
|
+
<secret>ohairoflamao12345</secret>
|
71
|
+
</auth_getSession_response>
|
72
|
+
XML
|
73
|
+
end
|
74
|
+
end
|
metadata
ADDED
@@ -0,0 +1,278 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: facebooker-lite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 67
|
9
|
+
version: 1.0.67
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Chad Fowler
|
13
|
+
- Patrick Ewing
|
14
|
+
- Mike Mangino
|
15
|
+
- Shane Vitarana
|
16
|
+
- Corey Innis
|
17
|
+
- Mike Mangino
|
18
|
+
autorequire:
|
19
|
+
bindir: bin
|
20
|
+
cert_chain: []
|
21
|
+
|
22
|
+
date: 2010-04-19 00:00:00 +02:00
|
23
|
+
default_executable:
|
24
|
+
dependencies:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: json_pure
|
27
|
+
prerelease: false
|
28
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
segments:
|
33
|
+
- 1
|
34
|
+
- 0
|
35
|
+
- 0
|
36
|
+
version: 1.0.0
|
37
|
+
type: :runtime
|
38
|
+
version_requirements: *id001
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: rubyforge
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
49
|
+
- 3
|
50
|
+
version: 2.0.3
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: gemcutter
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
- 5
|
63
|
+
- 0
|
64
|
+
version: 0.5.0
|
65
|
+
type: :development
|
66
|
+
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: hoe
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 2
|
76
|
+
- 5
|
77
|
+
- 0
|
78
|
+
version: 2.5.0
|
79
|
+
type: :development
|
80
|
+
version_requirements: *id004
|
81
|
+
description: |-
|
82
|
+
Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]. Its goals are:
|
83
|
+
|
84
|
+
* Idiomatic Ruby
|
85
|
+
* No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
|
86
|
+
* Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
|
87
|
+
* Well tested
|
88
|
+
|
89
|
+
This is a lite version with most view/helper stuff removed.
|
90
|
+
email:
|
91
|
+
- chad@chadfowlwer.com
|
92
|
+
- ""
|
93
|
+
- ""
|
94
|
+
- ""
|
95
|
+
- ""
|
96
|
+
- mmangino@elevatedrails.com
|
97
|
+
executables: []
|
98
|
+
|
99
|
+
extensions: []
|
100
|
+
|
101
|
+
extra_rdoc_files:
|
102
|
+
- Manifest.txt
|
103
|
+
- CHANGELOG.rdoc
|
104
|
+
- README.rdoc
|
105
|
+
- COPYING.rdoc
|
106
|
+
- TODO.rdoc
|
107
|
+
files:
|
108
|
+
- .autotest
|
109
|
+
- CHANGELOG.rdoc
|
110
|
+
- COPYING.rdoc
|
111
|
+
- Manifest.txt
|
112
|
+
- README.rdoc
|
113
|
+
- Rakefile
|
114
|
+
- TODO.rdoc
|
115
|
+
- facebooker.gemspec
|
116
|
+
- generators/xd_receiver/templates/xd_receiver_ssl.html
|
117
|
+
- generators/xd_receiver/templates/xd_receiver.html
|
118
|
+
- generators/xd_receiver/xd_receiver_generator.rb
|
119
|
+
- init.rb
|
120
|
+
- install.rb
|
121
|
+
- lib/facebooker.rb
|
122
|
+
- lib/facebooker/adapters/adapter_base.rb
|
123
|
+
- lib/facebooker/adapters/bebo_adapter.rb
|
124
|
+
- lib/facebooker/adapters/facebook_adapter.rb
|
125
|
+
- lib/facebooker/attachment.rb
|
126
|
+
- lib/facebooker/admin.rb
|
127
|
+
- lib/facebooker/application.rb
|
128
|
+
- lib/facebooker/batch_request.rb
|
129
|
+
- lib/facebooker/data.rb
|
130
|
+
- lib/facebooker/feed.rb
|
131
|
+
- lib/facebooker/logging.rb
|
132
|
+
- lib/facebooker/mobile.rb
|
133
|
+
- lib/facebooker/mock/service.rb
|
134
|
+
- lib/facebooker/mock/session.rb
|
135
|
+
- lib/facebooker/model.rb
|
136
|
+
- lib/facebooker/models/affiliation.rb
|
137
|
+
- lib/facebooker/models/album.rb
|
138
|
+
- lib/facebooker/models/applicationproperties.rb
|
139
|
+
- lib/facebooker/models/applicationrestrictions.rb
|
140
|
+
- lib/facebooker/models/cookie.rb
|
141
|
+
- lib/facebooker/models/comment.rb
|
142
|
+
- lib/facebooker/models/education_info.rb
|
143
|
+
- lib/facebooker/models/event.rb
|
144
|
+
- lib/facebooker/models/family_relative_info.rb
|
145
|
+
- lib/facebooker/models/friend_list.rb
|
146
|
+
- lib/facebooker/models/group.rb
|
147
|
+
- lib/facebooker/models/info_item.rb
|
148
|
+
- lib/facebooker/models/info_section.rb
|
149
|
+
- lib/facebooker/models/location.rb
|
150
|
+
- lib/facebooker/models/notifications.rb
|
151
|
+
- lib/facebooker/models/page.rb
|
152
|
+
- lib/facebooker/models/photo.rb
|
153
|
+
- lib/facebooker/models/tag.rb
|
154
|
+
- lib/facebooker/models/user.rb
|
155
|
+
- lib/facebooker/models/video.rb
|
156
|
+
- lib/facebooker/models/work_info.rb
|
157
|
+
- lib/facebooker/models/message_thread.rb
|
158
|
+
- lib/facebooker/parser.rb
|
159
|
+
- lib/facebooker/rails/backwards_compatible_param_checks.rb
|
160
|
+
- lib/facebooker/rails/controller.rb
|
161
|
+
- lib/facebooker/rails/extensions/action_controller.rb
|
162
|
+
- lib/facebooker/rails/extensions/rack_setup.rb
|
163
|
+
- lib/facebooker/rails/extensions/routing.rb
|
164
|
+
- lib/facebooker/rails/facebook_pretty_errors.rb
|
165
|
+
- lib/facebooker/rails/facebook_request_fix.rb
|
166
|
+
- lib/facebooker/rails/facebook_request_fix_2-3.rb
|
167
|
+
- lib/facebooker/rails/facebook_session_handling.rb
|
168
|
+
- lib/facebooker/rails/facebook_url_rewriting.rb
|
169
|
+
- lib/facebooker/rails/helpers/fb_connect.rb
|
170
|
+
- lib/facebooker/rails/integration_session.rb
|
171
|
+
- lib/facebooker/rails/profile_publisher_extensions.rb
|
172
|
+
- lib/facebooker/rails/publisher.rb
|
173
|
+
- lib/facebooker/rails/routing.rb
|
174
|
+
- lib/facebooker/rails/test_helpers.rb
|
175
|
+
- lib/facebooker/rails/utilities.rb
|
176
|
+
- lib/facebooker/server_cache.rb
|
177
|
+
- lib/facebooker/service.rb
|
178
|
+
- lib/facebooker/service/base_service.rb
|
179
|
+
- lib/facebooker/service/curl_service.rb
|
180
|
+
- lib/facebooker/service/net_http_service.rb
|
181
|
+
- lib/facebooker/service/typhoeus_service.rb
|
182
|
+
- lib/facebooker/service/typhoeus_multi_service.rb
|
183
|
+
- lib/facebooker/session.rb
|
184
|
+
- lib/facebooker/stream_post.rb
|
185
|
+
- lib/facebooker/version.rb
|
186
|
+
- lib/net/http_multipart_post.rb
|
187
|
+
- lib/rack/facebook.rb
|
188
|
+
- lib/rack/facebook_session.rb
|
189
|
+
- lib/tasks/facebooker.rake
|
190
|
+
- lib/tasks/facebooker.rb
|
191
|
+
- lib/tasks/tunnel.rake
|
192
|
+
- rails/init.rb
|
193
|
+
- setup.rb
|
194
|
+
- templates/layout.erb
|
195
|
+
- test/facebooker/adapters_test.rb
|
196
|
+
- test/facebooker/admin_test.rb
|
197
|
+
- test/facebooker/application_test.rb
|
198
|
+
- test/facebooker/attachment_test.rb
|
199
|
+
- test/facebooker/batch_request_test.rb
|
200
|
+
- test/facebooker/data_test.rb
|
201
|
+
- test/facebooker/logging_test.rb
|
202
|
+
- test/facebooker/mobile_test.rb
|
203
|
+
- test/facebooker/model_test.rb
|
204
|
+
- test/facebooker/models/event_test.rb
|
205
|
+
- test/facebooker/models/page_test.rb
|
206
|
+
- test/facebooker/models/photo_test.rb
|
207
|
+
- test/facebooker/models/user_test.rb
|
208
|
+
- test/facebooker/rails/publisher_test.rb
|
209
|
+
- test/facebooker/rails_integration_test.rb
|
210
|
+
- test/facebooker/rails/facebook_request_fix_2-3_test.rb
|
211
|
+
- test/facebooker/server_cache_test.rb
|
212
|
+
- test/facebooker/session_test.rb
|
213
|
+
- test/facebooker_test.rb
|
214
|
+
- test/fixtures/multipart_post_body_with_only_parameters.txt
|
215
|
+
- test/fixtures/multipart_post_body_with_single_file.txt
|
216
|
+
- test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt
|
217
|
+
- test/net/http_multipart_post_test.rb
|
218
|
+
- test/rack/facebook_test.rb
|
219
|
+
- test/rack/facebook_session_test.rb
|
220
|
+
- test/rails_test_helper.rb
|
221
|
+
- test/test_helper.rb
|
222
|
+
has_rdoc: true
|
223
|
+
homepage: http://facebooker.rubyforge.org
|
224
|
+
licenses: []
|
225
|
+
|
226
|
+
post_install_message:
|
227
|
+
rdoc_options:
|
228
|
+
- --main
|
229
|
+
- README.rdoc
|
230
|
+
require_paths:
|
231
|
+
- lib
|
232
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
segments:
|
237
|
+
- 0
|
238
|
+
version: "0"
|
239
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - ">="
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
segments:
|
244
|
+
- 0
|
245
|
+
version: "0"
|
246
|
+
requirements: []
|
247
|
+
|
248
|
+
rubyforge_project: facebooker-lite
|
249
|
+
rubygems_version: 1.3.6
|
250
|
+
signing_key:
|
251
|
+
specification_version: 3
|
252
|
+
summary: Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]
|
253
|
+
test_files:
|
254
|
+
- test/net/http_multipart_post_test.rb
|
255
|
+
- test/facebooker/models/event_test.rb
|
256
|
+
- test/facebooker/models/photo_test.rb
|
257
|
+
- test/facebooker/models/page_test.rb
|
258
|
+
- test/facebooker/models/user_test.rb
|
259
|
+
- test/facebooker/admin_test.rb
|
260
|
+
- test/facebooker/session_test.rb
|
261
|
+
- test/facebooker/data_test.rb
|
262
|
+
- test/facebooker/rails_integration_test.rb
|
263
|
+
- test/facebooker/service_test.rb
|
264
|
+
- test/facebooker/model_test.rb
|
265
|
+
- test/facebooker/server_cache_test.rb
|
266
|
+
- test/facebooker/application_test.rb
|
267
|
+
- test/facebooker/mobile_test.rb
|
268
|
+
- test/facebooker/batch_request_test.rb
|
269
|
+
- test/facebooker/rails/publisher_test.rb
|
270
|
+
- test/facebooker/rails/facebook_url_rewriting_test.rb
|
271
|
+
- test/facebooker/rails/integration_session_test.rb
|
272
|
+
- test/facebooker/rails/facebook_request_fix_2-3_test.rb
|
273
|
+
- test/facebooker/adapters_test.rb
|
274
|
+
- test/facebooker/logging_test.rb
|
275
|
+
- test/facebooker/attachment_test.rb
|
276
|
+
- test/rack/facebook_test.rb
|
277
|
+
- test/rack/facebook_session_test.rb
|
278
|
+
- test/facebooker_test.rb
|