devise_facebook_open_graph 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
22
  .bundle
23
+ *.gem
data/README.rdoc CHANGED
@@ -157,7 +157,8 @@ There are some configuration options which you can add in config/initializers/de
157
157
 
158
158
  When a user is signed in via facebook connect you have access to the user's facebook session by calling <tt>facebook_session</tt>
159
159
  inside a controller or view. With this session you have access to the user's open graph by calling <tt>facebook_session.graph</tt>.
160
- See the simple example on how to extract user's data from Facebook above.
160
+ See the simple example on how to extract user's data from Facebook above. <tt>facebook_session</tt> will return nil if we where unable
161
+ to parse the cookie set by Facebook's JavaScript SDK or if it hasn't been set at all.
161
162
 
162
163
 
163
164
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{devise_facebook_open_graph}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thorbj\303\270rn Hermansen"]
12
- s.date = %q{2010-06-15}
12
+ s.date = %q{2010-06-16}
13
13
  s.description = %q{Extends Devise with an authentication strategy against Facebook's Open Graph and it's JavaScrip SDK}
14
14
  s.email = %q{thhermansen@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -11,6 +11,11 @@ module DeviseFacebookOpenGraph
11
11
  #
12
12
  FACEBOOK_SESSION_KEYS = %w(session_key expires uid sig secret access_token)
13
13
 
14
+ def self.new_or_nil_if_invalid(cookies)
15
+ session = new(cookies)
16
+ return session if session.valid?
17
+ end
18
+
14
19
  #
15
20
  # Creates a new Facebook session based cookies hash from a request
16
21
  #
@@ -52,7 +57,7 @@ module DeviseFacebookOpenGraph
52
57
  private
53
58
  def parse_cookie # :nodoc:
54
59
  oauth = Koala::Facebook::OAuth.new(Config.application_id, Config.application_secret)
55
- parsed = oauth.get_user_from_cookie(@cookies)
60
+ oauth.get_user_from_cookie(@cookies)
56
61
  end
57
62
  end
58
63
  end
@@ -10,7 +10,7 @@ module DeviseFacebookOpenGraph
10
10
  end
11
11
 
12
12
  def facebook_session
13
- @facebook_session ||= DeviseFacebookOpenGraph::Facebook::Session.new(cookies)
13
+ @facebook_session ||= DeviseFacebookOpenGraph::Facebook::Session.new_or_nil_if_invalid(cookies)
14
14
  end
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_facebook_open_graph
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Thorbj\xC3\xB8rn Hermansen"
@@ -15,13 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-15 00:00:00 +02:00
18
+ date: 2010-06-16 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rails
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ name: rails
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
@@ -33,12 +33,12 @@ dependencies:
33
33
  - 0
34
34
  - beta3
35
35
  version: 3.0.0.beta3
36
+ requirement: *id001
36
37
  type: :runtime
37
- version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency
39
- name: rake
40
39
  prerelease: false
41
- requirement: &id002 !ruby/object:Gem::Requirement
40
+ name: rake
41
+ version_requirements: &id002 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ">="
@@ -47,12 +47,12 @@ dependencies:
47
47
  segments:
48
48
  - 0
49
49
  version: "0"
50
+ requirement: *id002
50
51
  type: :development
51
- version_requirements: *id002
52
52
  - !ruby/object:Gem::Dependency
53
- name: rspec
54
53
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
54
+ name: rspec
55
+ version_requirements: &id003 !ruby/object:Gem::Requirement
56
56
  none: false
57
57
  requirements:
58
58
  - - ">="
@@ -61,12 +61,12 @@ dependencies:
61
61
  segments:
62
62
  - 0
63
63
  version: "0"
64
+ requirement: *id003
64
65
  type: :development
65
- version_requirements: *id003
66
66
  - !ruby/object:Gem::Dependency
67
- name: devise
68
67
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
68
+ name: devise
69
+ version_requirements: &id004 !ruby/object:Gem::Requirement
70
70
  none: false
71
71
  requirements:
72
72
  - - ">="
@@ -77,12 +77,12 @@ dependencies:
77
77
  - 1
78
78
  - rc1
79
79
  version: 1.1.rc1
80
+ requirement: *id004
80
81
  type: :runtime
81
- version_requirements: *id004
82
82
  - !ruby/object:Gem::Dependency
83
- name: json
84
83
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
84
+ name: json
85
+ version_requirements: &id005 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ">="
@@ -91,12 +91,12 @@ dependencies:
91
91
  segments:
92
92
  - 0
93
93
  version: "0"
94
+ requirement: *id005
94
95
  type: :runtime
95
- version_requirements: *id005
96
96
  - !ruby/object:Gem::Dependency
97
- name: jeweler
98
97
  prerelease: false
99
- requirement: &id006 !ruby/object:Gem::Requirement
98
+ name: jeweler
99
+ version_requirements: &id006 !ruby/object:Gem::Requirement
100
100
  none: false
101
101
  requirements:
102
102
  - - ">="
@@ -105,12 +105,12 @@ dependencies:
105
105
  segments:
106
106
  - 0
107
107
  version: "0"
108
+ requirement: *id006
108
109
  type: :development
109
- version_requirements: *id006
110
110
  - !ruby/object:Gem::Dependency
111
- name: bundler
112
111
  prerelease: false
113
- requirement: &id007 !ruby/object:Gem::Requirement
112
+ name: bundler
113
+ version_requirements: &id007 !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
116
116
  - - ">="
@@ -119,12 +119,12 @@ dependencies:
119
119
  segments:
120
120
  - 0
121
121
  version: "0"
122
+ requirement: *id007
122
123
  type: :development
123
- version_requirements: *id007
124
124
  - !ruby/object:Gem::Dependency
125
- name: koala
126
125
  prerelease: false
127
- requirement: &id008 !ruby/object:Gem::Requirement
126
+ name: koala
127
+ version_requirements: &id008 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ">="
@@ -133,8 +133,8 @@ dependencies:
133
133
  segments:
134
134
  - 0
135
135
  version: "0"
136
+ requirement: *id008
136
137
  type: :runtime
137
- version_requirements: *id008
138
138
  description: Extends Devise with an authentication strategy against Facebook's Open Graph and it's JavaScrip SDK
139
139
  email: thhermansen@gmail.com
140
140
  executables: []