Module: Facebooker
- Defined in:
- lib/facebooker/version.rb,
lib/facebooker.rb,
lib/facebooker/data.rb,
lib/facebooker/feed.rb,
lib/facebooker/admin.rb,
lib/facebooker/model.rb,
lib/facebooker/mobile.rb,
lib/facebooker/parser.rb,
lib/facebooker/logging.rb,
lib/facebooker/service.rb,
lib/facebooker/session.rb,
lib/facebooker/models/tag.rb,
lib/facebooker/models/page.rb,
lib/facebooker/models/user.rb,
lib/facebooker/mock/service.rb,
lib/facebooker/mock/session.rb,
lib/facebooker/models/album.rb,
lib/facebooker/models/event.rb,
lib/facebooker/models/group.rb,
lib/facebooker/models/photo.rb,
lib/facebooker/models/video.rb,
lib/facebooker/server_cache.rb,
lib/facebooker/batch_request.rb,
lib/facebooker/models/cookie.rb,
lib/facebooker/rails/helpers.rb,
lib/facebooker/rails/routing.rb,
lib/facebooker/rails/cucumber.rb,
lib/facebooker/models/location.rb,
lib/facebooker/rails/publisher.rb,
lib/facebooker/rails/utilities.rb,
lib/facebooker/models/info_item.rb,
lib/facebooker/models/work_info.rb,
lib/facebooker/rails/controller.rb,
lib/facebooker/models/affiliation.rb,
lib/facebooker/models/friend_list.rb,
lib/facebooker/rails/test_helpers.rb,
lib/facebooker/models/info_section.rb,
lib/facebooker/models/notifications.rb,
lib/facebooker/rails/cucumber/world.rb,
lib/facebooker/adapters/adapter_base.rb,
lib/facebooker/adapters/bebo_adapter.rb,
lib/facebooker/adapters/bebo_adapter.rb,
lib/facebooker/models/education_info.rb,
lib/facebooker/rails/helpers/fb_connect.rb,
lib/facebooker/adapters/facebook_adapter.rb,
lib/facebooker/rails/facebook_form_builder.rb,
lib/facebooker/models/applicationproperties.rb,
lib/facebooker/models/applicationrestrictions.rb,
lib/facebooker/rails/profile_publisher_extensions.rb
Overview
Things that don’t actually work as expected in BEBO
Defined Under Namespace
Modules: Feed, Logging, Model, Rails, VERSION
Classes: AdapterBase, AddTags, Admin, Affiliation, Album, ApplicationProperties, ApplicationRestrictions, AreFriends, BatchRequest, BatchRun, BeboAdapter, CanvasSession, Cookie, CreateAlbum, CreateToken, Data, DeactivateTemplateBundleByID, EducationInfo, Errors, Event, EventMembersGet, EventsGet, EventsRsvp, FacebookAdapter, FqlMultiquery, FqlQuery, FriendList, FriendListsGet, GetAlbums, GetAllocation, GetAppProperties, GetAppUsers, GetCookies, GetFriends, GetLoggedInUser, GetPhotos, GetPreference, GetRegisteredTemplateBundles, GetRestrictionInfo, GetSession, GetTags, GetUnconnectedFriendsCount, Group, GroupGetMembers, GroupsGet, InfoItem, InfoSection, Location, Mobile, MockService, MockSession, NonSessionUser, Notifications, NotificationsGet, NotificationsSend, NotificationsSendEmail, Page, PagesGetInfo, PagesIsAdmin, PagesIsFan, Parser, Photo, ProfileFBML, ProfileFBMLSet, ProfileInfo, ProfileInfoSet, PublishActionOfUser, PublishStoryToUser, PublishTemplatizedAction, PublishUserAction, RefreshImgSrc, RefreshRefURL, RegisterTemplateBundle, RegisterUsers, RevokeAuthorization, SendRequest, ServerCache, Service, Session, SetAppProperties, SetCookie, SetPreference, SetRefHandle, SetRestrictionInfo, SetStatus, SmsCanSend, SmsSend, StreamAddComment, StreamPublish, Tag, UnregisterUsers, UploadPhoto, UploadVideo, User, UserHasPermission, UserInfo, UserStandardInfo, Video, WorkInfo
Constant Summary
collapse
- @@logger =
nil
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.current_adapter ⇒ Object
.path_prefix ⇒ Object
Returns the value of attribute path_prefix.
178
179
180
|
# File 'lib/facebooker.rb', line 178
def path_prefix
@path_prefix
end
|
.set_asset_host_to_callback_url ⇒ Object
Returns the value of attribute set_asset_host_to_callback_url.
161
162
163
|
# File 'lib/facebooker.rb', line 161
def set_asset_host_to_callback_url
@set_asset_host_to_callback_url
end
|
.use_curl ⇒ Object
Also known as:
use_curl?
Returns the value of attribute use_curl.
162
163
164
|
# File 'lib/facebooker.rb', line 162
def use_curl
@use_curl
end
|
Class Method Details
.all_api_keys ⇒ Object
104
105
106
107
108
109
110
111
112
|
# File 'lib/facebooker.rb', line 104
def all_api_keys
[
@raw_facebooker_configuration['api_key']
] + (
@raw_facebooker_configuration['alternative_keys'] ?
@raw_facebooker_configuration['alternative_keys'].keys :
[]
)
end
|
.apply_configuration(config) ⇒ Object
Sets the Facebook environment based on a hash of options. By default the hash passed in is loaded from facebooker.yml, but it can also be passed in manually every request to run multiple Facebook apps off one Rails app.
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/facebooker.rb', line 57
def apply_configuration(config)
ENV['FACEBOOK_API_KEY'] = config['api_key']
ENV['FACEBOOK_SECRET_KEY'] = config['secret_key']
ENV['FACEBOOKER_RELATIVE_URL_ROOT'] = config['canvas_page_name']
ENV['FACEBOOKER_API'] = config['api']
if config.has_key?('set_asset_host_to_callback_url')
Facebooker.set_asset_host_to_callback_url = config['set_asset_host_to_callback_url']
end
if Object.const_defined?("ActionController") and Facebooker.set_asset_host_to_callback_url
ActionController::Base.asset_host = config['callback_url']
end
Facebooker.timeout = config['timeout']
@facebooker_configuration = config load_adapter(:fb_sig_api_key => config['api_key'])
facebooker_config
end
|
.facebook_path_prefix ⇒ Object
Default is canvas_page_name in yml file
153
154
155
|
# File 'lib/facebooker.rb', line 153
def facebook_path_prefix
current_adapter.facebook_path_prefix
end
|
.facebook_path_prefix=(path) ⇒ Object
148
149
150
|
# File 'lib/facebooker.rb', line 148
def facebook_path_prefix=(path)
current_adapter.facebook_path_prefix = path
end
|
.facebooker_config ⇒ Object
75
76
77
|
# File 'lib/facebooker.rb', line 75
def facebooker_config
@facebooker_configuration
end
|
.fetch_config_for(api_key) ⇒ Object
122
123
124
125
126
127
128
129
130
131
|
# File 'lib/facebooker.rb', line 122
def fetch_config_for(api_key)
if @raw_facebooker_configuration['api_key'] == api_key
return @raw_facebooker_configuration
elsif @raw_facebooker_configuration['alternative_keys'] and
@raw_facebooker_configuration['alternative_keys'].keys.include?(api_key)
return @raw_facebooker_configuration['alternative_keys'][api_key].merge(
'api_key' => api_key )
end
return false
end
|
.is_for?(application_container) ⇒ Boolean
157
158
159
|
# File 'lib/facebooker.rb', line 157
def is_for?(application_container)
current_adapter.is_for?(application_container)
end
|
.load_adapter(params) ⇒ Object
.load_configuration(facebooker_yaml_file) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/facebooker.rb', line 44
def load_configuration(facebooker_yaml_file)
return false unless File.exist?(facebooker_yaml_file)
@raw_facebooker_configuration = YAML.load(ERB.new(File.read(facebooker_yaml_file)).result)
if defined? RAILS_ENV
@raw_facebooker_configuration = @raw_facebooker_configuration[RAILS_ENV]
end
Thread.current[:fb_api_config] = @raw_facebooker_configuration unless Thread.current[:fb_api_config]
apply_configuration(@raw_facebooker_configuration)
end
|
.logger ⇒ Object
7
8
9
|
# File 'lib/facebooker/logging.rb', line 7
def self.logger
@@logger
end
|
.logger=(logger) ⇒ Object
4
5
6
|
# File 'lib/facebooker/logging.rb', line 4
def self.logger=(logger)
@@logger = logger
end
|
.request_for_canvas(arg) ⇒ Object
prevent Facebooker from adding canvas name as prefix to URLs
197
198
199
200
201
202
203
204
205
|
# File 'lib/facebooker.rb', line 197
def request_for_canvas(is_canvas_request)
original_path_prefix = @path_prefix
begin
@path_prefix = facebook_path_prefix if is_canvas_request
yield
ensure
@path_prefix = original_path_prefix
end
end
|
.timeout ⇒ Object
169
170
171
|
# File 'lib/facebooker.rb', line 169
def timeout
@timeout
end
|
.timeout=(val) ⇒ Object
165
166
167
|
# File 'lib/facebooker.rb', line 165
def timeout=(val)
@timeout = val.to_i
end
|
.with_all_applications(&block) ⇒ Object
114
115
116
117
118
119
120
|
# File 'lib/facebooker.rb', line 114
def with_all_applications(&block)
all_api_keys.each do |current_api_key|
with_application(current_api_key) do
block.call
end
end
end
|
.with_application(api_key, &block) ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/facebooker.rb', line 79
def with_application(api_key, &block)
config = fetch_config_for( api_key )
unless config
self.logger.info "Can't find facebooker config: '#{api_key}'" if self.logger
yield if block_given?
return
end
old = Thread.current[:fb_api_config] ? Thread.current[:fb_api_config].dup : @raw_facebooker_configuration
if block_given?
begin
self.logger.info "Swapping facebooker config: '#{api_key}'" if self.logger
Thread.current[:fb_api_config] = apply_configuration(config)
yield
ensure
Thread.current[:fb_api_config] = old if old && !old.empty?
apply_configuration(Thread.current[:fb_api_config])
end
end
end
|
.with_asset_path_for_canvas ⇒ Object
Set the asset path to the canvas path for just this one request by definition, we will make this a canvas request