fb_graph 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/fb_graph.gemspec +1 -1
  3. data/lib/fb_graph/auth.rb +11 -3
  4. metadata +3 -3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.5.2
data/fb_graph.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fb_graph}
8
- s.version = "1.5.1"
8
+ s.version = "1.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["nov matake"]
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
- self.access_token = build_access_token(data)
43
- self.user = User.new(data[:user_id], data[:user].merge(:access_token => self.access_token))
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
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 1
10
- version: 1.5.1
9
+ - 2
10
+ version: 1.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake