Module: Facebooker
- Defined in:
- lib/facebooker/version.rb,
lib/facebooker.rb,
lib/facebooker.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, 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.
154
155
156
|
# File 'lib/facebooker.rb', line 154
def path_prefix
@path_prefix
end
|
.set_asset_host_to_callback_url ⇒ Object
Returns the value of attribute set_asset_host_to_callback_url.
137
138
139
|
# File 'lib/facebooker.rb', line 137
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.
138
139
140
|
# File 'lib/facebooker.rb', line 138
def use_curl
@use_curl
end
|
Class Method Details
.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.
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/facebooker.rb', line 51
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
129
130
131
|
# File 'lib/facebooker.rb', line 129
def facebook_path_prefix
current_adapter.facebook_path_prefix
end
|
.facebook_path_prefix=(path) ⇒ Object
124
125
126
|
# File 'lib/facebooker.rb', line 124
def facebook_path_prefix=(path)
current_adapter.facebook_path_prefix = path
end
|
.facebooker_config ⇒ Object
69
70
71
|
# File 'lib/facebooker.rb', line 69
def facebooker_config
@facebooker_configuration
end
|
.fetch_config_for(api_key) ⇒ Object
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/facebooker.rb', line 98
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
133
134
135
|
# File 'lib/facebooker.rb', line 133
def is_for?(application_container)
current_adapter.is_for?(application_container)
end
|
.json_decode(str) ⇒ Object
4
5
6
|
# File 'lib/facebooker.rb', line 4
def self.json_decode(str)
JSON.parse(str)
end
|
.json_encode(o) ⇒ Object
8
9
10
|
# File 'lib/facebooker.rb', line 8
def self.json_encode(o)
JSON.dump(o)
end
|
.load_adapter(params) ⇒ Object
.load_configuration(facebooker_yaml_file) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/facebooker.rb', line 38
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
173
174
175
176
177
178
179
180
181
|
# File 'lib/facebooker.rb', line 173
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
145
146
147
|
# File 'lib/facebooker.rb', line 145
def timeout
@timeout
end
|
.timeout=(val) ⇒ Object
141
142
143
|
# File 'lib/facebooker.rb', line 141
def timeout=(val)
@timeout = val.to_i
end
|
.with_application(api_key, &block) ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/facebooker.rb', line 73
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