Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for the renaming of GraphAPI to API since Koala 1.2.0.

  • Loading branch information...
commit 4781b9e834a79a8fa6d59550e22b788b6422db1e 1 parent 6d38ca9
@james2m authored
View
5 lib/authlogic_facebook_shim/adapters/koala_adapter.rb
@@ -4,6 +4,7 @@ module KoalaAdapter
def facebook_session
@facebook_session ||= begin
+
oauth = Koala::Facebook::OAuth.new(facebook_app_id, facebook_secret_key)
if oauth.respond_to?(:get_user_info_from_cookie)
user_info = oauth.get_user_info_from_cookie(controller.cookies)
@@ -11,6 +12,7 @@ def facebook_session
user_info = oauth.get_user_from_cookie(controller.cookies)
end
OpenStruct.new( user_info ) if user_info
+
end
end
@@ -21,7 +23,8 @@ def facebook_session?
def facebook_user
@facebook_user ||= begin
- facebook_graph = Koala::Facebook::GraphAPI.new(facebook_session.access_token)
+ graph_api = Koala::Facebook.const_defined?(:API) ? Koala::Facebook::API : Koala::Facebook::GraphAPI
+ facebook_graph = graph_api.new(facebook_session.access_token)
user = facebook_graph.get_object('me')
user[:uid] = user.delete('id')
OpenStruct.new( user )
View
1  lib/authlogic_facebook_shim/session/facebook.rb
@@ -27,7 +27,6 @@ def authenticating_with_facebook?
def validate_by_facebook
facebook_uid = facebook_user.uid
self.attempted_record = klass.send(facebook_finder, facebook_uid)
-
if self.attempted_record || !facebook_auto_register?
return @logged_in_with_facebook = !!self.attempted_record
else
View
3  test/units/adapters/koala_adapter_test.rb
@@ -185,7 +185,8 @@
before do
@graph_api = MiniTest::Mock.new
- override Koala::Facebook::GraphAPI, :new => @graph_api
+ graph_api = Koala::Facebook.const_defined?(:API) ? Koala::Facebook::API : Koala::Facebook::GraphAPI
+ override graph_api, :new => @graph_api
facebook_session = MiniTest::Mock.new
access_token = MiniTest::Mock.new
Please sign in to comment.
Something went wrong with that request. Please try again.