fotonauts-facebooker 1.0.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. data/.autotest +15 -0
  2. data/CHANGELOG.rdoc +24 -0
  3. data/COPYING.rdoc +19 -0
  4. data/Manifest.txt +152 -0
  5. data/README.rdoc +119 -0
  6. data/Rakefile +94 -0
  7. data/TODO.rdoc +4 -0
  8. data/examples/desktop_login.rb +14 -0
  9. data/facebooker.gemspec +45 -0
  10. data/generators/facebook/facebook_generator.rb +14 -0
  11. data/generators/facebook/templates/config/facebooker.yml +49 -0
  12. data/generators/facebook/templates/public/javascripts/facebooker.js +332 -0
  13. data/generators/facebook_controller/USAGE +33 -0
  14. data/generators/facebook_controller/facebook_controller_generator.rb +40 -0
  15. data/generators/facebook_controller/templates/controller.rb +7 -0
  16. data/generators/facebook_controller/templates/functional_test.rb +11 -0
  17. data/generators/facebook_controller/templates/helper.rb +2 -0
  18. data/generators/facebook_controller/templates/view.fbml.erb +2 -0
  19. data/generators/facebook_controller/templates/view.html.erb +2 -0
  20. data/generators/facebook_publisher/facebook_publisher_generator.rb +14 -0
  21. data/generators/facebook_publisher/templates/create_facebook_templates.rb +15 -0
  22. data/generators/facebook_publisher/templates/publisher.rb +3 -0
  23. data/generators/facebook_scaffold/USAGE +27 -0
  24. data/generators/facebook_scaffold/facebook_scaffold_generator.rb +118 -0
  25. data/generators/facebook_scaffold/templates/controller.rb +93 -0
  26. data/generators/facebook_scaffold/templates/facebook_style.css +2579 -0
  27. data/generators/facebook_scaffold/templates/functional_test.rb +89 -0
  28. data/generators/facebook_scaffold/templates/helper.rb +2 -0
  29. data/generators/facebook_scaffold/templates/layout.fbml.erb +6 -0
  30. data/generators/facebook_scaffold/templates/layout.html.erb +17 -0
  31. data/generators/facebook_scaffold/templates/style.css +74 -0
  32. data/generators/facebook_scaffold/templates/view_edit.fbml.erb +13 -0
  33. data/generators/facebook_scaffold/templates/view_edit.html.erb +18 -0
  34. data/generators/facebook_scaffold/templates/view_index.fbml.erb +24 -0
  35. data/generators/facebook_scaffold/templates/view_index.html.erb +24 -0
  36. data/generators/facebook_scaffold/templates/view_new.fbml.erb +12 -0
  37. data/generators/facebook_scaffold/templates/view_new.html.erb +17 -0
  38. data/generators/facebook_scaffold/templates/view_show.fbml.erb +10 -0
  39. data/generators/facebook_scaffold/templates/view_show.html.erb +10 -0
  40. data/generators/publisher/publisher_generator.rb +14 -0
  41. data/generators/xd_receiver/templates/xd_receiver.html +10 -0
  42. data/generators/xd_receiver/templates/xd_receiver_ssl.html +10 -0
  43. data/generators/xd_receiver/xd_receiver_generator.rb +10 -0
  44. data/init.rb +26 -0
  45. data/install.rb +12 -0
  46. data/lib/facebooker.rb +275 -0
  47. data/lib/facebooker/adapters/adapter_base.rb +91 -0
  48. data/lib/facebooker/adapters/bebo_adapter.rb +77 -0
  49. data/lib/facebooker/adapters/facebook_adapter.rb +60 -0
  50. data/lib/facebooker/admin.rb +42 -0
  51. data/lib/facebooker/application.rb +37 -0
  52. data/lib/facebooker/attachment.rb +51 -0
  53. data/lib/facebooker/batch_request.rb +45 -0
  54. data/lib/facebooker/data.rb +57 -0
  55. data/lib/facebooker/feed.rb +78 -0
  56. data/lib/facebooker/logging.rb +44 -0
  57. data/lib/facebooker/mobile.rb +20 -0
  58. data/lib/facebooker/mock/service.rb +50 -0
  59. data/lib/facebooker/mock/session.rb +18 -0
  60. data/lib/facebooker/model.rb +139 -0
  61. data/lib/facebooker/models/affiliation.rb +10 -0
  62. data/lib/facebooker/models/album.rb +11 -0
  63. data/lib/facebooker/models/applicationproperties.rb +39 -0
  64. data/lib/facebooker/models/applicationrestrictions.rb +10 -0
  65. data/lib/facebooker/models/comment.rb +9 -0
  66. data/lib/facebooker/models/cookie.rb +10 -0
  67. data/lib/facebooker/models/education_info.rb +11 -0
  68. data/lib/facebooker/models/event.rb +28 -0
  69. data/lib/facebooker/models/family_relative_info.rb +7 -0
  70. data/lib/facebooker/models/friend_list.rb +16 -0
  71. data/lib/facebooker/models/group.rb +36 -0
  72. data/lib/facebooker/models/info_item.rb +10 -0
  73. data/lib/facebooker/models/info_section.rb +10 -0
  74. data/lib/facebooker/models/location.rb +8 -0
  75. data/lib/facebooker/models/message_thread.rb +89 -0
  76. data/lib/facebooker/models/notifications.rb +17 -0
  77. data/lib/facebooker/models/page.rb +46 -0
  78. data/lib/facebooker/models/photo.rb +19 -0
  79. data/lib/facebooker/models/tag.rb +12 -0
  80. data/lib/facebooker/models/user.rb +751 -0
  81. data/lib/facebooker/models/video.rb +9 -0
  82. data/lib/facebooker/models/work_info.rb +10 -0
  83. data/lib/facebooker/parser.rb +970 -0
  84. data/lib/facebooker/rails/backwards_compatible_param_checks.rb +31 -0
  85. data/lib/facebooker/rails/controller.rb +353 -0
  86. data/lib/facebooker/rails/cucumber.rb +28 -0
  87. data/lib/facebooker/rails/cucumber/world.rb +40 -0
  88. data/lib/facebooker/rails/extensions/action_controller.rb +48 -0
  89. data/lib/facebooker/rails/extensions/rack_setup.rb +16 -0
  90. data/lib/facebooker/rails/extensions/routing.rb +15 -0
  91. data/lib/facebooker/rails/facebook_form_builder.rb +141 -0
  92. data/lib/facebooker/rails/facebook_pretty_errors.rb +22 -0
  93. data/lib/facebooker/rails/facebook_request_fix.rb +28 -0
  94. data/lib/facebooker/rails/facebook_request_fix_2-3.rb +31 -0
  95. data/lib/facebooker/rails/facebook_session_handling.rb +68 -0
  96. data/lib/facebooker/rails/facebook_url_helper.rb +192 -0
  97. data/lib/facebooker/rails/facebook_url_rewriting.rb +60 -0
  98. data/lib/facebooker/rails/helpers.rb +835 -0
  99. data/lib/facebooker/rails/helpers/fb_connect.rb +165 -0
  100. data/lib/facebooker/rails/helpers/stream_publish.rb +22 -0
  101. data/lib/facebooker/rails/integration_session.rb +38 -0
  102. data/lib/facebooker/rails/profile_publisher_extensions.rb +42 -0
  103. data/lib/facebooker/rails/publisher.rb +608 -0
  104. data/lib/facebooker/rails/routing.rb +49 -0
  105. data/lib/facebooker/rails/test_helpers.rb +68 -0
  106. data/lib/facebooker/rails/utilities.rb +22 -0
  107. data/lib/facebooker/server_cache.rb +24 -0
  108. data/lib/facebooker/service.rb +103 -0
  109. data/lib/facebooker/service/base_service.rb +19 -0
  110. data/lib/facebooker/service/curl_service.rb +44 -0
  111. data/lib/facebooker/service/net_http_service.rb +12 -0
  112. data/lib/facebooker/service/typhoeus_multi_service.rb +27 -0
  113. data/lib/facebooker/service/typhoeus_service.rb +17 -0
  114. data/lib/facebooker/session.rb +786 -0
  115. data/lib/facebooker/stream_post.rb +19 -0
  116. data/lib/facebooker/version.rb +9 -0
  117. data/lib/net/http_multipart_post.rb +123 -0
  118. data/lib/rack/facebook.rb +89 -0
  119. data/lib/rack/facebook_session.rb +21 -0
  120. data/lib/tasks/facebooker.rake +19 -0
  121. data/lib/tasks/facebooker.rb +2 -0
  122. data/lib/tasks/tunnel.rake +46 -0
  123. data/rails/init.rb +1 -0
  124. data/setup.rb +1585 -0
  125. data/templates/layout.erb +24 -0
  126. data/test/facebooker/adapters_test.rb +191 -0
  127. data/test/facebooker/admin_test.rb +102 -0
  128. data/test/facebooker/application_test.rb +110 -0
  129. data/test/facebooker/attachment_test.rb +72 -0
  130. data/test/facebooker/batch_request_test.rb +83 -0
  131. data/test/facebooker/data_test.rb +86 -0
  132. data/test/facebooker/logging_test.rb +43 -0
  133. data/test/facebooker/mobile_test.rb +45 -0
  134. data/test/facebooker/model_test.rb +133 -0
  135. data/test/facebooker/models/event_test.rb +15 -0
  136. data/test/facebooker/models/page_test.rb +56 -0
  137. data/test/facebooker/models/photo_test.rb +16 -0
  138. data/test/facebooker/models/user_test.rb +1074 -0
  139. data/test/facebooker/rails/facebook_request_fix_2-3_test.rb +25 -0
  140. data/test/facebooker/rails/facebook_url_rewriting_test.rb +76 -0
  141. data/test/facebooker/rails/integration_session_test.rb +13 -0
  142. data/test/facebooker/rails/publisher_test.rb +538 -0
  143. data/test/facebooker/rails_integration_test.rb +1543 -0
  144. data/test/facebooker/server_cache_test.rb +44 -0
  145. data/test/facebooker/service_test.rb +58 -0
  146. data/test/facebooker/session_test.rb +883 -0
  147. data/test/facebooker_test.rb +1263 -0
  148. data/test/fixtures/multipart_post_body_with_only_parameters.txt +33 -0
  149. data/test/fixtures/multipart_post_body_with_single_file.txt +38 -0
  150. data/test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt +38 -0
  151. data/test/net/http_multipart_post_test.rb +52 -0
  152. data/test/rack/facebook_session_test.rb +34 -0
  153. data/test/rack/facebook_test.rb +73 -0
  154. data/test/rails_test_helper.rb +36 -0
  155. data/test/test_helper.rb +74 -0
  156. metadata +303 -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
@@ -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,303 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fotonauts-facebooker
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-03-30 00:00:00 +00:00
23
+ default_executable:
24
+ dependencies:
25
+ - !ruby/object:Gem::Dependency
26
+ name: yajl-ruby
27
+ prerelease: false
28
+ requirement: &id001 !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ segments:
33
+ - 0
34
+ - 7
35
+ - 5
36
+ version: 0.7.5
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: json_pure
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ segments:
47
+ - 1
48
+ - 0
49
+ - 0
50
+ version: 1.0.0
51
+ type: :runtime
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
54
+ name: hoe
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ segments:
61
+ - 2
62
+ - 4
63
+ - 0
64
+ version: 2.4.0
65
+ type: :development
66
+ version_requirements: *id003
67
+ description: |-
68
+ Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]. Its goals are:
69
+
70
+ * Idiomatic Ruby
71
+ * No dependencies outside of the Ruby standard library (This is true with Rails 2.1. Previous Rails versions require the JSON gem)
72
+ * Concrete classes and methods modeling the Facebook data, so it's easy for a Rubyist to understand what's available
73
+ * Well tested
74
+ email:
75
+ - chad@chadfowlwer.com
76
+ - ""
77
+ - ""
78
+ - ""
79
+ - ""
80
+ - mmangino@elevatedrails.com
81
+ executables: []
82
+
83
+ extensions: []
84
+
85
+ extra_rdoc_files:
86
+ - Manifest.txt
87
+ - CHANGELOG.rdoc
88
+ - COPYING.rdoc
89
+ - README.rdoc
90
+ - TODO.rdoc
91
+ files:
92
+ - .autotest
93
+ - CHANGELOG.rdoc
94
+ - COPYING.rdoc
95
+ - Manifest.txt
96
+ - README.rdoc
97
+ - Rakefile
98
+ - TODO.rdoc
99
+ - examples/desktop_login.rb
100
+ - facebooker.gemspec
101
+ - generators/facebook/facebook_generator.rb
102
+ - generators/facebook/templates/config/facebooker.yml
103
+ - generators/facebook/templates/public/javascripts/facebooker.js
104
+ - generators/facebook_controller/USAGE
105
+ - generators/facebook_controller/facebook_controller_generator.rb
106
+ - generators/facebook_controller/templates/controller.rb
107
+ - generators/facebook_controller/templates/functional_test.rb
108
+ - generators/facebook_controller/templates/helper.rb
109
+ - generators/facebook_controller/templates/view.fbml.erb
110
+ - generators/facebook_controller/templates/view.html.erb
111
+ - generators/facebook_publisher/facebook_publisher_generator.rb
112
+ - generators/facebook_publisher/templates/create_facebook_templates.rb
113
+ - generators/facebook_publisher/templates/publisher.rb
114
+ - generators/facebook_scaffold/USAGE
115
+ - generators/facebook_scaffold/facebook_scaffold_generator.rb
116
+ - generators/facebook_scaffold/templates/controller.rb
117
+ - generators/facebook_scaffold/templates/facebook_style.css
118
+ - generators/facebook_scaffold/templates/functional_test.rb
119
+ - generators/facebook_scaffold/templates/helper.rb
120
+ - generators/facebook_scaffold/templates/layout.fbml.erb
121
+ - generators/facebook_scaffold/templates/layout.html.erb
122
+ - generators/facebook_scaffold/templates/style.css
123
+ - generators/facebook_scaffold/templates/view_edit.fbml.erb
124
+ - generators/facebook_scaffold/templates/view_edit.html.erb
125
+ - generators/facebook_scaffold/templates/view_index.fbml.erb
126
+ - generators/facebook_scaffold/templates/view_index.html.erb
127
+ - generators/facebook_scaffold/templates/view_new.fbml.erb
128
+ - generators/facebook_scaffold/templates/view_new.html.erb
129
+ - generators/facebook_scaffold/templates/view_show.fbml.erb
130
+ - generators/facebook_scaffold/templates/view_show.html.erb
131
+ - generators/publisher/publisher_generator.rb
132
+ - generators/xd_receiver/templates/xd_receiver_ssl.html
133
+ - generators/xd_receiver/templates/xd_receiver.html
134
+ - generators/xd_receiver/xd_receiver_generator.rb
135
+ - init.rb
136
+ - install.rb
137
+ - lib/facebooker.rb
138
+ - lib/facebooker/adapters/adapter_base.rb
139
+ - lib/facebooker/adapters/bebo_adapter.rb
140
+ - lib/facebooker/adapters/facebook_adapter.rb
141
+ - lib/facebooker/attachment.rb
142
+ - lib/facebooker/admin.rb
143
+ - lib/facebooker/application.rb
144
+ - lib/facebooker/batch_request.rb
145
+ - lib/facebooker/data.rb
146
+ - lib/facebooker/feed.rb
147
+ - lib/facebooker/logging.rb
148
+ - lib/facebooker/mobile.rb
149
+ - lib/facebooker/mock/service.rb
150
+ - lib/facebooker/mock/session.rb
151
+ - lib/facebooker/model.rb
152
+ - lib/facebooker/models/affiliation.rb
153
+ - lib/facebooker/models/album.rb
154
+ - lib/facebooker/models/applicationproperties.rb
155
+ - lib/facebooker/models/applicationrestrictions.rb
156
+ - lib/facebooker/models/cookie.rb
157
+ - lib/facebooker/models/comment.rb
158
+ - lib/facebooker/models/education_info.rb
159
+ - lib/facebooker/models/event.rb
160
+ - lib/facebooker/models/family_relative_info.rb
161
+ - lib/facebooker/models/friend_list.rb
162
+ - lib/facebooker/models/group.rb
163
+ - lib/facebooker/models/info_item.rb
164
+ - lib/facebooker/models/info_section.rb
165
+ - lib/facebooker/models/location.rb
166
+ - lib/facebooker/models/notifications.rb
167
+ - lib/facebooker/models/page.rb
168
+ - lib/facebooker/models/photo.rb
169
+ - lib/facebooker/models/tag.rb
170
+ - lib/facebooker/models/user.rb
171
+ - lib/facebooker/models/video.rb
172
+ - lib/facebooker/models/work_info.rb
173
+ - lib/facebooker/models/message_thread.rb
174
+ - lib/facebooker/parser.rb
175
+ - lib/facebooker/rails/backwards_compatible_param_checks.rb
176
+ - lib/facebooker/rails/controller.rb
177
+ - lib/facebooker/rails/cucumber.rb
178
+ - lib/facebooker/rails/cucumber/world.rb
179
+ - lib/facebooker/rails/extensions/action_controller.rb
180
+ - lib/facebooker/rails/extensions/rack_setup.rb
181
+ - lib/facebooker/rails/extensions/routing.rb
182
+ - lib/facebooker/rails/facebook_form_builder.rb
183
+ - lib/facebooker/rails/facebook_pretty_errors.rb
184
+ - lib/facebooker/rails/facebook_request_fix.rb
185
+ - lib/facebooker/rails/facebook_request_fix_2-3.rb
186
+ - lib/facebooker/rails/facebook_session_handling.rb
187
+ - lib/facebooker/rails/facebook_url_helper.rb
188
+ - lib/facebooker/rails/facebook_url_rewriting.rb
189
+ - lib/facebooker/rails/helpers.rb
190
+ - lib/facebooker/rails/helpers/fb_connect.rb
191
+ - lib/facebooker/rails/helpers/stream_publish.rb
192
+ - lib/facebooker/rails/integration_session.rb
193
+ - lib/facebooker/rails/profile_publisher_extensions.rb
194
+ - lib/facebooker/rails/publisher.rb
195
+ - lib/facebooker/rails/routing.rb
196
+ - lib/facebooker/rails/test_helpers.rb
197
+ - lib/facebooker/rails/utilities.rb
198
+ - lib/facebooker/server_cache.rb
199
+ - lib/facebooker/service.rb
200
+ - lib/facebooker/service/base_service.rb
201
+ - lib/facebooker/service/curl_service.rb
202
+ - lib/facebooker/service/net_http_service.rb
203
+ - lib/facebooker/service/typhoeus_service.rb
204
+ - lib/facebooker/service/typhoeus_multi_service.rb
205
+ - lib/facebooker/session.rb
206
+ - lib/facebooker/stream_post.rb
207
+ - lib/facebooker/version.rb
208
+ - lib/net/http_multipart_post.rb
209
+ - lib/rack/facebook.rb
210
+ - lib/rack/facebook_session.rb
211
+ - lib/tasks/facebooker.rake
212
+ - lib/tasks/facebooker.rb
213
+ - lib/tasks/tunnel.rake
214
+ - rails/init.rb
215
+ - setup.rb
216
+ - templates/layout.erb
217
+ - test/facebooker/adapters_test.rb
218
+ - test/facebooker/admin_test.rb
219
+ - test/facebooker/application_test.rb
220
+ - test/facebooker/attachment_test.rb
221
+ - test/facebooker/batch_request_test.rb
222
+ - test/facebooker/data_test.rb
223
+ - test/facebooker/logging_test.rb
224
+ - test/facebooker/mobile_test.rb
225
+ - test/facebooker/model_test.rb
226
+ - test/facebooker/models/event_test.rb
227
+ - test/facebooker/models/page_test.rb
228
+ - test/facebooker/models/photo_test.rb
229
+ - test/facebooker/models/user_test.rb
230
+ - test/facebooker/rails/publisher_test.rb
231
+ - test/facebooker/rails_integration_test.rb
232
+ - test/facebooker/rails/facebook_request_fix_2-3_test.rb
233
+ - test/facebooker/server_cache_test.rb
234
+ - test/facebooker/session_test.rb
235
+ - test/facebooker_test.rb
236
+ - test/fixtures/multipart_post_body_with_only_parameters.txt
237
+ - test/fixtures/multipart_post_body_with_single_file.txt
238
+ - test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt
239
+ - test/net/http_multipart_post_test.rb
240
+ - test/rack/facebook_test.rb
241
+ - test/rack/facebook_session_test.rb
242
+ - test/rails_test_helper.rb
243
+ - test/test_helper.rb
244
+ - test/facebooker/rails/facebook_url_rewriting_test.rb
245
+ - test/facebooker/rails/integration_session_test.rb
246
+ - test/facebooker/service_test.rb
247
+ has_rdoc: true
248
+ homepage: http://facebooker.rubyforge.org
249
+ licenses: []
250
+
251
+ post_install_message:
252
+ rdoc_options:
253
+ - --main
254
+ - README.rdoc
255
+ require_paths:
256
+ - lib
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ requirements:
259
+ - - ">="
260
+ - !ruby/object:Gem::Version
261
+ segments:
262
+ - 0
263
+ version: "0"
264
+ required_rubygems_version: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - ">="
267
+ - !ruby/object:Gem::Version
268
+ segments:
269
+ - 0
270
+ version: "0"
271
+ requirements: []
272
+
273
+ rubyforge_project: facebooker
274
+ rubygems_version: 1.3.6
275
+ signing_key:
276
+ specification_version: 3
277
+ summary: Facebooker is a Ruby wrapper over the Facebook[http://facebook.com] {REST API}[http://wiki.developers.facebook.com/index.php/API]
278
+ test_files:
279
+ - test/facebooker/adapters_test.rb
280
+ - test/facebooker/admin_test.rb
281
+ - test/facebooker/application_test.rb
282
+ - test/facebooker/attachment_test.rb
283
+ - test/facebooker/batch_request_test.rb
284
+ - test/facebooker/data_test.rb
285
+ - test/facebooker/logging_test.rb
286
+ - test/facebooker/mobile_test.rb
287
+ - test/facebooker/model_test.rb
288
+ - test/facebooker/models/event_test.rb
289
+ - test/facebooker/models/page_test.rb
290
+ - test/facebooker/models/photo_test.rb
291
+ - test/facebooker/models/user_test.rb
292
+ - test/facebooker/rails/facebook_request_fix_2-3_test.rb
293
+ - test/facebooker/rails/facebook_url_rewriting_test.rb
294
+ - test/facebooker/rails/integration_session_test.rb
295
+ - test/facebooker/rails/publisher_test.rb
296
+ - test/facebooker/rails_integration_test.rb
297
+ - test/facebooker/server_cache_test.rb
298
+ - test/facebooker/service_test.rb
299
+ - test/facebooker/session_test.rb
300
+ - test/facebooker_test.rb
301
+ - test/net/http_multipart_post_test.rb
302
+ - test/rack/facebook_session_test.rb
303
+ - test/rack/facebook_test.rb