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/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/models/album.rb,
lib/facebooker/models/event.rb,
lib/facebooker/models/group.rb,
lib/facebooker/models/photo.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/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/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/rails/profile_publisher_extensions.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Feed, Logging, Model, Rails, VERSION Classes: AdapterBase, AddTags, Admin, Affiliation, Album, ApplicationProperties, 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, GetSession, GetTags, Group, GroupGetMembers, GroupsGet, InfoItem, InfoSection, Location, NonSessionUser, Notifications, NotificationsGet, NotificationsSend, NotificationsSendEmail, Page, PagesGetInfo, PagesIsAdmin, Parser, Photo, ProfileFBML, ProfileFBMLSet, ProfileInfo, ProfileInfoSet, PublishActionOfUser, PublishStoryToUser, PublishTemplatizedAction, PublishUserAction, RefreshImgSrc, RefreshRefURL, RegisterTemplateBundle, RegisterUsers, SendRequest, ServerCache, Service, Session, SetAppProperties, SetCookie, SetPreference, SetRefHandle, SetStatus, Tag, UploadPhoto, User, UserHasPermission, UserInfo, UserStandardInfo, WorkInfo

Constant Summary collapse

@@logger =
nil

Class Method Summary collapse

Class Method Details

.current_adapterObject



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

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

.current_adapter=(adapter_class) ⇒ Object



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

def current_adapter=(adapter_class)
  @current_adapter = adapter_class
end

.facebook_path_prefixObject

Default is canvas_page_name in yml file



68
69
70
# File 'lib/facebooker.rb', line 68

def facebook_path_prefix
  current_adapter.facebook_path_prefix
end

.facebook_path_prefix=(path) ⇒ Object



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

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

.facebooker_configObject



47
48
49
# File 'lib/facebooker.rb', line 47

def facebooker_config
  @facebooker_configuration 
end

.is_for?(application_container) ⇒ Boolean

Returns:

  • (Boolean)


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

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

.load_adapter(params) ⇒ Object



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

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
# 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']
    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



97
98
99
# File 'lib/facebooker.rb', line 97

def path_prefix
@path_prefix
end

.request_for_canvas(is_canvas_request) ⇒ Object

If this request is_canvas_request then use the application name as the url root



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

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

.timeoutObject



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

def timeout
  @timeout
end

.timeout=(val) ⇒ Object



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

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

.use_curl=(val) ⇒ Object



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

def use_curl=(val)
  @use_curl=val
end

.use_curl?Boolean

Returns:

  • (Boolean)


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

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



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/facebooker.rb', line 104

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