facebooker-lite 1.0.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/.autotest +15 -0
  2. data/CHANGELOG.rdoc +24 -0
  3. data/COPYING.rdoc +19 -0
  4. data/Manifest.txt +114 -0
  5. data/README.rdoc +120 -0
  6. data/Rakefile +94 -0
  7. data/TODO.rdoc +4 -0
  8. data/facebooker.gemspec +42 -0
  9. data/generators/xd_receiver/templates/xd_receiver.html +10 -0
  10. data/generators/xd_receiver/templates/xd_receiver_ssl.html +10 -0
  11. data/generators/xd_receiver/xd_receiver_generator.rb +10 -0
  12. data/init.rb +25 -0
  13. data/install.rb +12 -0
  14. data/lib/facebooker.rb +261 -0
  15. data/lib/facebooker/adapters/adapter_base.rb +91 -0
  16. data/lib/facebooker/adapters/bebo_adapter.rb +77 -0
  17. data/lib/facebooker/adapters/facebook_adapter.rb +60 -0
  18. data/lib/facebooker/admin.rb +42 -0
  19. data/lib/facebooker/application.rb +37 -0
  20. data/lib/facebooker/attachment.rb +51 -0
  21. data/lib/facebooker/batch_request.rb +45 -0
  22. data/lib/facebooker/data.rb +57 -0
  23. data/lib/facebooker/feed.rb +78 -0
  24. data/lib/facebooker/logging.rb +44 -0
  25. data/lib/facebooker/mobile.rb +20 -0
  26. data/lib/facebooker/mock/service.rb +50 -0
  27. data/lib/facebooker/mock/session.rb +18 -0
  28. data/lib/facebooker/model.rb +139 -0
  29. data/lib/facebooker/models/affiliation.rb +10 -0
  30. data/lib/facebooker/models/album.rb +11 -0
  31. data/lib/facebooker/models/applicationproperties.rb +39 -0
  32. data/lib/facebooker/models/applicationrestrictions.rb +10 -0
  33. data/lib/facebooker/models/comment.rb +9 -0
  34. data/lib/facebooker/models/cookie.rb +10 -0
  35. data/lib/facebooker/models/education_info.rb +11 -0
  36. data/lib/facebooker/models/event.rb +28 -0
  37. data/lib/facebooker/models/family_relative_info.rb +7 -0
  38. data/lib/facebooker/models/friend_list.rb +16 -0
  39. data/lib/facebooker/models/group.rb +36 -0
  40. data/lib/facebooker/models/info_item.rb +10 -0
  41. data/lib/facebooker/models/info_section.rb +10 -0
  42. data/lib/facebooker/models/location.rb +8 -0
  43. data/lib/facebooker/models/message_thread.rb +89 -0
  44. data/lib/facebooker/models/notifications.rb +17 -0
  45. data/lib/facebooker/models/page.rb +46 -0
  46. data/lib/facebooker/models/photo.rb +19 -0
  47. data/lib/facebooker/models/tag.rb +12 -0
  48. data/lib/facebooker/models/user.rb +751 -0
  49. data/lib/facebooker/models/video.rb +9 -0
  50. data/lib/facebooker/models/work_info.rb +10 -0
  51. data/lib/facebooker/parser.rb +970 -0
  52. data/lib/facebooker/rails/backwards_compatible_param_checks.rb +31 -0
  53. data/lib/facebooker/rails/controller.rb +353 -0
  54. data/lib/facebooker/rails/extensions/action_controller.rb +47 -0
  55. data/lib/facebooker/rails/extensions/rack_setup.rb +16 -0
  56. data/lib/facebooker/rails/extensions/routing.rb +15 -0
  57. data/lib/facebooker/rails/facebook_pretty_errors.rb +22 -0
  58. data/lib/facebooker/rails/facebook_request_fix.rb +28 -0
  59. data/lib/facebooker/rails/facebook_request_fix_2-3.rb +31 -0
  60. data/lib/facebooker/rails/facebook_session_handling.rb +68 -0
  61. data/lib/facebooker/rails/facebook_url_rewriting.rb +60 -0
  62. data/lib/facebooker/rails/helpers/fb_connect.rb +75 -0
  63. data/lib/facebooker/rails/integration_session.rb +38 -0
  64. data/lib/facebooker/rails/profile_publisher_extensions.rb +42 -0
  65. data/lib/facebooker/rails/publisher.rb +608 -0
  66. data/lib/facebooker/rails/routing.rb +49 -0
  67. data/lib/facebooker/rails/test_helpers.rb +68 -0
  68. data/lib/facebooker/rails/utilities.rb +22 -0
  69. data/lib/facebooker/server_cache.rb +24 -0
  70. data/lib/facebooker/service.rb +103 -0
  71. data/lib/facebooker/service/base_service.rb +19 -0
  72. data/lib/facebooker/service/curl_service.rb +44 -0
  73. data/lib/facebooker/service/net_http_service.rb +12 -0
  74. data/lib/facebooker/service/typhoeus_multi_service.rb +27 -0
  75. data/lib/facebooker/service/typhoeus_service.rb +17 -0
  76. data/lib/facebooker/session.rb +786 -0
  77. data/lib/facebooker/stream_post.rb +19 -0
  78. data/lib/facebooker/version.rb +9 -0
  79. data/lib/net/http_multipart_post.rb +123 -0
  80. data/lib/rack/facebook.rb +89 -0
  81. data/lib/rack/facebook_session.rb +21 -0
  82. data/lib/tasks/facebooker.rake +19 -0
  83. data/lib/tasks/facebooker.rb +2 -0
  84. data/lib/tasks/tunnel.rake +46 -0
  85. data/rails/init.rb +1 -0
  86. data/setup.rb +1585 -0
  87. data/templates/layout.erb +24 -0
  88. data/test/facebooker/adapters_test.rb +191 -0
  89. data/test/facebooker/admin_test.rb +102 -0
  90. data/test/facebooker/application_test.rb +110 -0
  91. data/test/facebooker/attachment_test.rb +72 -0
  92. data/test/facebooker/batch_request_test.rb +83 -0
  93. data/test/facebooker/data_test.rb +86 -0
  94. data/test/facebooker/logging_test.rb +43 -0
  95. data/test/facebooker/mobile_test.rb +45 -0
  96. data/test/facebooker/model_test.rb +133 -0
  97. data/test/facebooker/models/event_test.rb +15 -0
  98. data/test/facebooker/models/page_test.rb +56 -0
  99. data/test/facebooker/models/photo_test.rb +16 -0
  100. data/test/facebooker/models/user_test.rb +1074 -0
  101. data/test/facebooker/rails/facebook_request_fix_2-3_test.rb +25 -0
  102. data/test/facebooker/rails/facebook_url_rewriting_test.rb +76 -0
  103. data/test/facebooker/rails/integration_session_test.rb +13 -0
  104. data/test/facebooker/rails/publisher_test.rb +538 -0
  105. data/test/facebooker/rails_integration_test.rb +1543 -0
  106. data/test/facebooker/server_cache_test.rb +44 -0
  107. data/test/facebooker/service_test.rb +58 -0
  108. data/test/facebooker/session_test.rb +883 -0
  109. data/test/facebooker_test.rb +1263 -0
  110. data/test/fixtures/multipart_post_body_with_only_parameters.txt +33 -0
  111. data/test/fixtures/multipart_post_body_with_single_file.txt +38 -0
  112. data/test/fixtures/multipart_post_body_with_single_file_that_has_nil_key.txt +38 -0
  113. data/test/net/http_multipart_post_test.rb +52 -0
  114. data/test/rack/facebook_session_test.rb +34 -0
  115. data/test/rack/facebook_test.rb +73 -0
  116. data/test/rails_test_helper.rb +36 -0
  117. data/test/test_helper.rb +74 -0
  118. metadata +278 -0
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" >
4
+ <head>
5
+ <title>Cross-Domain Receiver Page</title>
6
+ </head>
7
+ <body>
8
+ <script src="https://ssl.connect.facebook.com/js/api_lib/v0.4/XdCommReceiver.js" type="text/javascript"></script>
9
+ </body>
10
+ </html>
@@ -0,0 +1,10 @@
1
+ class XdReceiverGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.template "xd_receiver.html", "public/xd_receiver.html"
5
+ m.template "xd_receiver_ssl.html", "public/xd_receiver_ssl.html"
6
+ end
7
+ end
8
+
9
+
10
+ end
data/init.rb ADDED
@@ -0,0 +1,25 @@
1
+ # Added support to the Facebooker.yml file for switching to the new profile design..
2
+ # Config parsing needs to happen before files are required.
3
+ facebook_config = "#{RAILS_ROOT}/config/facebooker.yml"
4
+
5
+ require 'facebooker'
6
+ FACEBOOKER = Facebooker.load_configuration(facebook_config)
7
+
8
+ # enable logger before including everything else, in case we ever want to log initialization
9
+ Facebooker.logger = RAILS_DEFAULT_LOGGER if Object.const_defined? :RAILS_DEFAULT_LOGGER
10
+
11
+ require 'net/http_multipart_post'
12
+ if defined? Rails
13
+ require 'facebooker/rails/backwards_compatible_param_checks'
14
+ require 'facebooker/rails/controller'
15
+ require 'facebooker/rails/facebook_url_rewriting'
16
+ require 'facebooker/rails/facebook_session_handling' if Rails.version < '2.3'
17
+ require 'facebooker/rails/facebook_request_fix' if Rails.version < '2.3'
18
+ require 'facebooker/rails/facebook_request_fix_2-3' if Rails.version >= '2.3'
19
+ require 'facebooker/rails/routing'
20
+ require 'facebooker/rails/facebook_pretty_errors' rescue nil
21
+ require 'facebooker/rails/extensions/rack_setup' if Rails.version > '2.3'
22
+ require 'facebooker/rails/extensions/action_controller'
23
+ #require 'facebooker/rails/extensions/action_view'
24
+ require 'facebooker/rails/extensions/routing'
25
+ end
@@ -0,0 +1,12 @@
1
+ require 'fileutils'
2
+ require 'rubygems'
3
+
4
+ dir = File.dirname(__FILE__)
5
+ templates = File.join(dir, 'generators', 'facebook', 'templates')
6
+ config = File.join('config', 'facebooker.yml')
7
+ script = File.join('public', 'javascripts', 'facebooker.js')
8
+
9
+ [config, script].each do |path|
10
+ FileUtils.cp File.join(templates, path), File.join(RAILS_ROOT, path) unless File.exist?(File.join(RAILS_ROOT, path))
11
+ end
12
+ puts IO.read(File.join(dir, 'README.rdoc'))
@@ -0,0 +1,261 @@
1
+ unless defined?(ActiveSupport) and defined?(ActiveSupport::JSON)
2
+ begin
3
+ require 'json'
4
+ rescue LoadError
5
+ gem "json_pure"
6
+ require "json"
7
+ end
8
+ module Facebooker
9
+ def self.json_decode(str)
10
+ JSON.parse(str)
11
+ end
12
+
13
+ def self.json_encode(o)
14
+ JSON.dump(o)
15
+ end
16
+ end
17
+ else
18
+ module Facebooker
19
+ def self.json_decode(str)
20
+ ActiveSupport::JSON.decode(str)
21
+ end
22
+
23
+ def self.json_encode(o)
24
+ ActiveSupport::JSON.encode(o)
25
+ end
26
+ end
27
+ end
28
+
29
+ require 'zlib'
30
+ require 'digest/md5'
31
+
32
+ module Facebooker
33
+
34
+ @facebooker_configuration = {}
35
+ @raw_facebooker_configuration = {}
36
+ @current_adapter = nil
37
+ @set_asset_host_to_callback_url = true
38
+ @path_prefix = nil
39
+ @use_curl = false
40
+
41
+ class << self
42
+
43
+ def load_configuration(facebooker_yaml_file)
44
+ return false unless File.exist?(facebooker_yaml_file)
45
+ @raw_facebooker_configuration = YAML.load(ERB.new(File.read(facebooker_yaml_file)).result)
46
+ if defined? RAILS_ENV
47
+ @raw_facebooker_configuration = @raw_facebooker_configuration[RAILS_ENV]
48
+ end
49
+ Thread.current[:fb_api_config] = @raw_facebooker_configuration unless Thread.current[:fb_api_config]
50
+ apply_configuration(@raw_facebooker_configuration)
51
+ end
52
+
53
+ # Sets the Facebook environment based on a hash of options.
54
+ # By default the hash passed in is loaded from facebooker.yml, but it can also be passed in
55
+ # manually every request to run multiple Facebook apps off one Rails app.
56
+ def apply_configuration(config)
57
+ ENV['FACEBOOK_API_KEY'] = config['api_key']
58
+ ENV['FACEBOOK_SECRET_KEY'] = config['secret_key']
59
+ ENV['FACEBOOKER_RELATIVE_URL_ROOT'] = config['canvas_page_name']
60
+ ENV['FACEBOOKER_API'] = config['api']
61
+ if config.has_key?('set_asset_host_to_callback_url')
62
+ Facebooker.set_asset_host_to_callback_url = config['set_asset_host_to_callback_url']
63
+ end
64
+ if Object.const_defined?("ActionController") and Facebooker.set_asset_host_to_callback_url
65
+ ActionController::Base.asset_host = config['callback_url']
66
+ end
67
+ Facebooker.timeout = config['timeout']
68
+
69
+ @facebooker_configuration = config # must be set before adapter loaded
70
+ load_adapter(:fb_sig_api_key => config['api_key'])
71
+ facebooker_config
72
+ end
73
+
74
+ def facebooker_config
75
+ @facebooker_configuration
76
+ end
77
+
78
+ def with_application(api_key, &block)
79
+ config = fetch_config_for( api_key )
80
+
81
+ unless config
82
+ self.logger.info "Can't find facebooker config: '#{api_key}'" if self.logger
83
+ yield if block_given?
84
+ return
85
+ end
86
+
87
+ # Save the old config to handle nested activation. If no app context is
88
+ # set yet, use default app's configuration.
89
+ old = Thread.current[:fb_api_config] ? Thread.current[:fb_api_config].dup : @raw_facebooker_configuration
90
+
91
+ if block_given?
92
+ begin
93
+ self.logger.info "Swapping facebooker config: '#{api_key}'" if self.logger
94
+ Thread.current[:fb_api_config] = apply_configuration(config)
95
+ yield
96
+ ensure
97
+ Thread.current[:fb_api_config] = old if old && !old.empty?
98
+ apply_configuration(Thread.current[:fb_api_config])
99
+ end
100
+ end
101
+ end
102
+
103
+ def all_api_keys
104
+ [
105
+ @raw_facebooker_configuration['api_key']
106
+ ] + (
107
+ @raw_facebooker_configuration['alternative_keys'] ?
108
+ @raw_facebooker_configuration['alternative_keys'].keys :
109
+ []
110
+ )
111
+ end
112
+
113
+ def with_all_applications(&block)
114
+ all_api_keys.each do |current_api_key|
115
+ with_application(current_api_key) do
116
+ block.call
117
+ end
118
+ end
119
+ end
120
+
121
+ def fetch_config_for(api_key)
122
+ if @raw_facebooker_configuration['api_key'] == api_key
123
+ return @raw_facebooker_configuration
124
+ elsif @raw_facebooker_configuration['alternative_keys'] and
125
+ @raw_facebooker_configuration['alternative_keys'].keys.include?(api_key)
126
+ return @raw_facebooker_configuration['alternative_keys'][api_key].merge(
127
+ 'api_key' => api_key )
128
+ end
129
+ return false
130
+ end
131
+
132
+ # TODO: This should be converted to attr_accessor, but we need to
133
+ # get all the require statements at the top of the file to work.
134
+
135
+ # Set the current adapter
136
+ attr_writer :current_adapter
137
+
138
+ # Get the current adapter
139
+ def current_adapter
140
+ @current_adapter || Facebooker::AdapterBase.default_adapter
141
+ end
142
+
143
+ def load_adapter(params)
144
+ self.current_adapter = Facebooker::AdapterBase.load_adapter(params)
145
+ end
146
+
147
+ def facebook_path_prefix=(path)
148
+ current_adapter.facebook_path_prefix = path
149
+ end
150
+
151
+ # Default is canvas_page_name in yml file
152
+ def facebook_path_prefix
153
+ current_adapter.facebook_path_prefix
154
+ end
155
+
156
+ def is_for?(application_container)
157
+ current_adapter.is_for?(application_container)
158
+ end
159
+
160
+ attr_accessor :set_asset_host_to_callback_url
161
+ attr_accessor :use_curl
162
+ alias :use_curl? :use_curl
163
+
164
+ def timeout=(val)
165
+ @timeout = val.to_i
166
+ end
167
+
168
+ def timeout
169
+ @timeout
170
+ end
171
+
172
+ [:api_key,:secret_key, :www_server_base_url,:login_url_base,:install_url_base,:permission_url_base,:connect_permission_url_base,:api_rest_path,:api_server_base,:api_server_base_url,:canvas_server_base, :video_server_base].each do |delegated_method|
173
+ define_method(delegated_method){ return current_adapter.send(delegated_method)}
174
+ end
175
+
176
+
177
+ attr_reader :path_prefix
178
+
179
+
180
+ # Set the asset path to the canvas path for just this one request
181
+ # by definition, we will make this a canvas request
182
+ def with_asset_path_for_canvas
183
+ original_asset_host = ActionController::Base.asset_host
184
+ begin
185
+ ActionController::Base.asset_host = Facebooker.api_server_base_url
186
+ request_for_canvas(true) do
187
+ yield
188
+ end
189
+ ensure
190
+ ActionController::Base.asset_host = original_asset_host
191
+ end
192
+ end
193
+
194
+ # If this request is_canvas_request
195
+ # then use the application name as the url root
196
+ def request_for_canvas(is_canvas_request)
197
+ original_path_prefix = @path_prefix
198
+ begin
199
+ @path_prefix = facebook_path_prefix if is_canvas_request
200
+ yield
201
+ ensure
202
+ @path_prefix = original_path_prefix
203
+ end
204
+ end
205
+ end
206
+ end
207
+
208
+ require 'facebooker/attachment'
209
+ require 'facebooker/batch_request'
210
+ require 'facebooker/feed'
211
+ require 'facebooker/logging'
212
+ require 'facebooker/model'
213
+ require 'facebooker/parser'
214
+ require 'facebooker/service'
215
+ require 'facebooker/service/base_service'
216
+ #optional HTTP service adapters
217
+ begin
218
+ require 'facebooker/service/curl_service'
219
+ rescue LoadError
220
+ nil
221
+ end
222
+ begin
223
+ require 'facebooker/service/typhoeus_service'
224
+ require 'facebooker/service/typhoeus_multi_service'
225
+ rescue LoadError
226
+ nil
227
+ end
228
+
229
+ require 'facebooker/service/net_http_service'
230
+ require 'facebooker/server_cache'
231
+ require 'facebooker/data'
232
+ require 'facebooker/admin'
233
+ require 'facebooker/application'
234
+ require 'facebooker/mobile'
235
+ require 'facebooker/session'
236
+ require 'facebooker/stream_post'
237
+ require 'facebooker/version'
238
+ require 'facebooker/models/location'
239
+ require 'facebooker/models/affiliation'
240
+ require 'facebooker/models/album'
241
+ require 'facebooker/models/comment'
242
+ require 'facebooker/models/education_info'
243
+ require 'facebooker/models/work_info'
244
+ require 'facebooker/models/event'
245
+ require 'facebooker/models/group'
246
+ require 'facebooker/models/notifications'
247
+ require 'facebooker/models/page'
248
+ require 'facebooker/models/photo'
249
+ require 'facebooker/models/cookie'
250
+ require 'facebooker/models/applicationproperties'
251
+ require 'facebooker/models/applicationrestrictions'
252
+ require 'facebooker/models/tag'
253
+ require 'facebooker/models/user'
254
+ require 'facebooker/models/info_item'
255
+ require 'facebooker/models/info_section'
256
+ require 'facebooker/models/friend_list'
257
+ require 'facebooker/models/video'
258
+ require 'facebooker/models/message_thread'
259
+ require 'facebooker/adapters/adapter_base'
260
+ require 'facebooker/adapters/facebook_adapter'
261
+ require 'facebooker/adapters/bebo_adapter'
@@ -0,0 +1,91 @@
1
+ module Facebooker
2
+
3
+ class AdapterBase
4
+ class UnableToLoadAdapter < Exception; end
5
+ require 'active_support/inflector'
6
+ include ActiveSupport::CoreExtensions::String::Inflections
7
+ def facebook_path_prefix
8
+ "/" + (@facebook_path_prefix || canvas_page_name || ENV['FACEBOOK_CANVAS_PATH'] || ENV['FACEBOOKER_RELATIVE_URL_ROOT'])
9
+ end
10
+
11
+ def facebook_path_prefix=(prefix)
12
+ @facebook_path_prefix = prefix
13
+ end
14
+
15
+ def facebooker_config
16
+ @config
17
+ end
18
+
19
+ def api_server_base_url
20
+ "http://" + api_server_base
21
+ end
22
+
23
+ def is_for?(application_context)
24
+ raise "SubClassShouldDefine"
25
+ end
26
+
27
+ def initialize(config)
28
+ @config = config
29
+ @facebook_path_prefix = nil
30
+ end
31
+
32
+ def self.facebooker_config
33
+ Facebooker.facebooker_config
34
+ end
35
+
36
+
37
+ def self.load_adapter(params)
38
+
39
+ config_key_base = params[:config_key_base] # This allows for loading of a aspecific adapter
40
+ config_key_base += "_" if config_key_base && config_key_base.length > 0
41
+
42
+ unless api_key = (params[:fb_sig_api_key] || facebooker_config["#{config_key_base}api_key"])
43
+ raise Facebooker::AdapterBase::UnableToLoadAdapter
44
+ end
45
+
46
+ unless facebooker_config
47
+ return self.default_adapter(params)
48
+ end
49
+
50
+ facebooker_config.each do |key,value|
51
+ next unless value == api_key
52
+
53
+ key_base = key.match(/(.*)[_]?api_key/)[1]
54
+
55
+ adapter_class_name = if !key_base || key_base.length == 0
56
+ "FacebookAdapter"
57
+ else
58
+ facebooker_config[key_base + "adapter"]
59
+ end
60
+
61
+ adapter_class = "Facebooker::#{adapter_class_name}".constantize
62
+
63
+ # Collect the rest of the configuration
64
+ adapter_config = {}
65
+ facebooker_config.each do |key,value|
66
+ if (match = key.match(/#{key_base}[_]?(.*)/))
67
+ adapter_config[match[1]] = value
68
+ end
69
+ end
70
+ return adapter_class.new(adapter_config)
71
+ end
72
+
73
+ return self.default_adapter(params)
74
+
75
+ end
76
+
77
+ def self.default_adapter(params = {})
78
+ if facebooker_config.nil? || (facebooker_config.blank? rescue nil)
79
+ config = { "api_key" => ENV['FACEBOOK_API_KEY'], "secret_key" => ENV['FACEBOOK_SECRET_KEY']}
80
+ else
81
+ config = facebooker_config
82
+ end
83
+ FacebookAdapter.new(config)
84
+ end
85
+
86
+ [:canvas_page_name, :api_key,:secret_key].each do |key_method|
87
+ define_method(key_method){ return facebooker_config[key_method.to_s]}
88
+ end
89
+
90
+ end
91
+ end
@@ -0,0 +1,77 @@
1
+ module Facebooker
2
+ class BeboAdapter < AdapterBase
3
+
4
+ def canvas_server_base
5
+ "apps.bebo.com"
6
+ end
7
+
8
+ def api_server_base
9
+ 'apps.bebo.com'
10
+ end
11
+
12
+ def api_rest_path
13
+ "/restserver.php"
14
+ end
15
+
16
+ def is_for?(application_context)
17
+ application_context == :bebo
18
+ end
19
+
20
+ def www_server_base_url
21
+ "www.bebo.com"
22
+ end
23
+
24
+
25
+ def login_url_base
26
+ "http://#{www_server_base_url}/SignIn.jsp?ApiKey=#{api_key}&v=1.0"
27
+ end
28
+
29
+ def install_url_base
30
+ "http://#{www_server_base_url}/c/apps/add?ApiKey=#{api_key}&v=1.0"
31
+ end
32
+ end
33
+ end
34
+
35
+ # Things that don't actually work as expected in BEBO
36
+ module Facebooker
37
+ class User
38
+ def set_profile_fbml_with_bebo_adapter(profile_fbml, mobile_fbml, profile_action_fbml, profile_main = nil)
39
+ if(Facebooker.is_for?(:bebo))
40
+ self.session.post('facebook.profile.setFBML', :uid => @id, :markup => profile_fbml)
41
+ else
42
+ set_profile_fbml_without_bebo_adapter(profile_fbml,mobile_fbml, profile_action_fbml, profile_main)
43
+ end
44
+ end
45
+ alias_method :set_profile_fbml_without_bebo_adapter, :set_profile_fbml
46
+ alias_method :set_profile_fbml, :set_profile_fbml_with_bebo_adapter
47
+
48
+ private
49
+
50
+ BEBO_FIELDS = FIELDS - [:meeting_sex, :wall_count, :meeting_for]
51
+
52
+ remove_method :collect
53
+
54
+ def collect(fields)
55
+ if(Facebooker.is_for?(:bebo) )
56
+ BEBO_FIELDS.reject{|field_name| !fields.empty? && !fields.include?(field_name)}.join(',')
57
+ else
58
+ FIELDS.reject{|field_name| !fields.empty? && !fields.include?(field_name)}.join(',')
59
+ end
60
+ end
61
+ end
62
+
63
+
64
+ class PublishTemplatizedAction < Parser#:nodoc:
65
+ class <<self
66
+ def process_with_bebo_adapter(data)
67
+ if(Facebooker.is_for?(:bebo))
68
+ element('feed_publishTemplatizedAction_response', data).content
69
+ else
70
+ process_without_bebo_adapter(data)
71
+ end
72
+ end
73
+ alias_method :process_without_bebo_adapter, :process
74
+ alias_method :process, :process_with_bebo_adapter
75
+ end
76
+ end
77
+ end