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

:nodoc:

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, FqlQuery, FriendList, FriendListsGet, GetAlbums, GetAllocation, GetAppProperties, GetAppUsers, GetCookies, GetFriends, GetLoggedInUser, GetPhotos, GetPreference, GetRegisteredTemplateBundles, GetRestrictionInfo, GetSession, GetTags, 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, SendRequest, ServerCache, Service, Session, SetAppProperties, SetCookie, SetPreference, SetRefHandle, SetRestrictionInfo, SetStatus, SmsCanSend, SmsSend, Tag, UploadPhoto, UploadVideo, User, UserHasPermission, UserInfo, UserStandardInfo, Video, WorkInfo

Constant Summary collapse

@@logger =
nil

Class Method Summary collapse

Class Method Details

.current_adapterObject



58
59
60
# File 'lib/facebooker.rb', line 58

def current_adapter
  @current_adapter || Facebooker::AdapterBase.default_adapter
end

.current_adapter=(adapter_class) ⇒ Object



54
55
56
# File 'lib/facebooker.rb', line 54

def current_adapter=(adapter_class)
  @current_adapter = adapter_class
end

.facebook_path_prefixObject

Default is canvas_page_name in yml file



71
72
73
# File 'lib/facebooker.rb', line 71

def facebook_path_prefix
  current_adapter.facebook_path_prefix
end

.facebook_path_prefix=(path) ⇒ Object



66
67
68
# File 'lib/facebooker.rb', line 66

def facebook_path_prefix=(path)
  current_adapter.facebook_path_prefix = path
end

.facebooker_configObject



50
51
52
# File 'lib/facebooker.rb', line 50

def facebooker_config
  @facebooker_configuration 
end

.is_for?(application_container) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/facebooker.rb', line 75

def is_for?(application_container)
  current_adapter.is_for?(application_container)
end

.load_adapter(params) ⇒ Object



62
63
64
# File 'lib/facebooker.rb', line 62

def load_adapter(params)
  self.current_adapter = Facebooker::AdapterBase.load_adapter(params)
end

.load_configuration(facebooker_yaml_file) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/facebooker.rb', line 28

def load_configuration(facebooker_yaml_file)
  if File.exist?(facebooker_yaml_file)
    if defined? RAILS_ENV
      facebooker = YAML.load_file(facebooker_yaml_file)[RAILS_ENV] 
    else
      facebooker = YAML.load_file(facebooker_yaml_file)           
    end
    ENV['FACEBOOK_API_KEY'] = facebooker['api_key']
    ENV['FACEBOOK_SECRET_KEY'] = facebooker['secret_key']
    ENV['FACEBOOKER_RELATIVE_URL_ROOT'] = facebooker['canvas_page_name']
    ENV['FACEBOOKER_API'] = facebooker['api']
    if facebooker.has_key?('set_asset_host_to_callback_url')
      Facebooker.set_asset_host_to_callback_url = facebooker['set_asset_host_to_callback_url'] 
    end
    Facebooker.timeout = facebooker['timeout']
    if Object.const_defined?("ActionController")
      ActionController::Base.asset_host = facebooker['callback_url'] if(ActionController::Base.asset_host.blank?)  && Facebooker.set_asset_host_to_callback_url
    end
    @facebooker_configuration = facebooker
  end
end

.loggerObject



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

.path_prefixObject



108
109
110
# File 'lib/facebooker.rb', line 108

def path_prefix
@path_prefix
end

.request_for_canvas(arg) ⇒ Object

prevent Facebooker from adding canvas name as prefix to URLs



129
130
131
132
133
134
135
136
137
# File 'lib/facebooker.rb', line 129

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

.set_asset_host_to_callback_urlObject



83
84
85
# File 'lib/facebooker.rb', line 83

def set_asset_host_to_callback_url
  @set_asset_host_to_callback_url.nil? ? true : @set_asset_host_to_callback_url
end

.set_asset_host_to_callback_url=(val) ⇒ Object



79
80
81
# File 'lib/facebooker.rb', line 79

def set_asset_host_to_callback_url=(val)
  @set_asset_host_to_callback_url=val
end

.timeoutObject



99
100
101
# File 'lib/facebooker.rb', line 99

def timeout
  @timeout
end

.timeout=(val) ⇒ Object



95
96
97
# File 'lib/facebooker.rb', line 95

def timeout=(val)
  @timeout = val.to_i
end

.use_curl=(val) ⇒ Object



87
88
89
# File 'lib/facebooker.rb', line 87

def use_curl=(val)
  @use_curl=val
end

.use_curl?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/facebooker.rb', line 91

def use_curl?
  @use_curl
end

.with_asset_path_for_canvasObject

Set the asset path to the canvas path for just this one request by definition, we will make this a canvas request



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/facebooker.rb', line 115

def with_asset_path_for_canvas
  original_asset_host = ActionController::Base.asset_host
  begin
    ActionController::Base.asset_host = Facebooker.api_server_base_url
    request_for_canvas(true) do
      yield
    end
  ensure
    ActionController::Base.asset_host = original_asset_host
  end
end