Skip to content
This repository
Browse code

Merge pull request #34 from ryansobol/add_verified_key

Add verified key to the info Hash
  • Loading branch information...
commit 46de6e723211c4e5c54ba90e9ceca1e8ab250380 2 parents 3de9ac0 + f93aef5
Mark Dodwell authored
3  README.md
Source Rendered
@@ -72,7 +72,8 @@ Here's an example *Authentication Hash* available in `request.env['omniauth.auth
72 72 :last_name => 'Bloggs',
73 73 :image => 'http://graph.facebook.com/1234567/picture?type=square',
74 74 :urls => { :Facebook => 'http://www.facebook.com/jbloggs' },
75   - :location => 'Palo Alto, California'
  75 + :location => 'Palo Alto, California',
  76 + :verified => true
76 77 },
77 78 :credentials => {
78 79 :token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
3  lib/omniauth/strategies/facebook.rb
@@ -41,7 +41,8 @@ class NoAuthorizationCodeError < StandardError; end
41 41 'Facebook' => raw_info['link'],
42 42 'Website' => raw_info['website']
43 43 },
44   - 'location' => (raw_info['location'] || {})['name']
  44 + 'location' => (raw_info['location'] || {})['name'],
  45 + 'verified' => raw_info['verified']
45 46 })
46 47 end
47 48
14 spec/omniauth/strategies/facebook_spec.rb
@@ -145,6 +145,10 @@
145 145 it 'has no urls' do
146 146 subject.info.should_not have_key('urls')
147 147 end
  148 +
  149 + it 'has no verified key' do
  150 + subject.info.should_not have_key('verified')
  151 + end
148 152 end
149 153
150 154 context 'when data is present in raw info' do
@@ -206,6 +210,16 @@
206 210 subject.info['urls']['Facebook'].should eq('http://www.facebook.com/fredsmith')
207 211 subject.info['urls']['Website'].should eq('https://my-wonderful-site.com')
208 212 end
  213 +
  214 + it 'returns the positive verified status' do
  215 + @raw_info['verified'] = true
  216 + subject.info['verified'].should be_true
  217 + end
  218 +
  219 + it 'returns the negative verified status' do
  220 + @raw_info['verified'] = false
  221 + subject.info['verified'].should be_false
  222 + end
209 223 end
210 224 end
211 225

0 comments on commit 46de6e7

Please sign in to comment.
Something went wrong with that request. Please try again.