fb_graph 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/fb_graph.gemspec +1 -1
- data/lib/fb_graph/auth.rb +11 -3
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.2
|
data/fb_graph.gemspec
CHANGED
data/lib/fb_graph/auth.rb
CHANGED
@@ -17,7 +17,7 @@ module FbGraph
|
|
17
17
|
class Auth
|
18
18
|
class VerificationFailed < Exception; end
|
19
19
|
|
20
|
-
attr_accessor :client, :access_token, :user
|
20
|
+
attr_accessor :client, :access_token, :user, :data
|
21
21
|
|
22
22
|
def initialize(client_id, client_secret, options = {})
|
23
23
|
@client = OAuth2::Client.new(client_id, client_secret, options.merge(
|
@@ -30,17 +30,25 @@ module FbGraph
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
def authorized?
|
34
|
+
self.access_token.present?
|
35
|
+
end
|
36
|
+
|
33
37
|
def from_cookie(cookie)
|
34
38
|
data = Cookie.parse(self.client, cookie)
|
35
39
|
self.access_token = build_access_token(data)
|
36
40
|
self.user = User.new(data[:uid], :access_token => self.access_token)
|
41
|
+
self.data = data
|
37
42
|
self
|
38
43
|
end
|
39
44
|
|
40
45
|
def from_signed_request(signed_request)
|
41
46
|
data = SignedRequest.verify(self.client, signed_request)
|
42
|
-
|
43
|
-
|
47
|
+
if data[:oauth_token]
|
48
|
+
self.access_token = build_access_token(data)
|
49
|
+
self.user = User.new(data[:user_id], data[:user].merge(:access_token => self.access_token))
|
50
|
+
end
|
51
|
+
self.data = data
|
44
52
|
self
|
45
53
|
end
|
46
54
|
|
metadata
CHANGED