Skip to content

Commit

Permalink
Merge pull request simi#34 from ryansobol/add_verified_key
Browse files Browse the repository at this point in the history
Add verified key to the info Hash
  • Loading branch information
mkdynamic committed Mar 9, 2012
2 parents 3de9ac0 + f93aef5 commit 46de6e7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -72,7 +72,8 @@ Here's an example *Authentication Hash* available in `request.env['omniauth.auth
:last_name => 'Bloggs',
:image => 'http://graph.facebook.com/1234567/picture?type=square',
:urls => { :Facebook => 'http://www.facebook.com/jbloggs' },
:location => 'Palo Alto, California'
:location => 'Palo Alto, California',
:verified => true
},
:credentials => {
:token => 'ABCDEF...', # OAuth 2.0 access_token, which you may wish to store
Expand Down
3 changes: 2 additions & 1 deletion lib/omniauth/strategies/facebook.rb
Expand Up @@ -41,7 +41,8 @@ class NoAuthorizationCodeError < StandardError; end
'Facebook' => raw_info['link'],
'Website' => raw_info['website']
},
'location' => (raw_info['location'] || {})['name']
'location' => (raw_info['location'] || {})['name'],
'verified' => raw_info['verified']
})
end

Expand Down
14 changes: 14 additions & 0 deletions spec/omniauth/strategies/facebook_spec.rb
Expand Up @@ -145,6 +145,10 @@
it 'has no urls' do
subject.info.should_not have_key('urls')
end

it 'has no verified key' do
subject.info.should_not have_key('verified')
end
end

context 'when data is present in raw info' do
Expand Down Expand Up @@ -206,6 +210,16 @@
subject.info['urls']['Facebook'].should eq('http://www.facebook.com/fredsmith')
subject.info['urls']['Website'].should eq('https://my-wonderful-site.com')
end

it 'returns the positive verified status' do
@raw_info['verified'] = true
subject.info['verified'].should be_true
end

it 'returns the negative verified status' do
@raw_info['verified'] = false
subject.info['verified'].should be_false
end
end
end

Expand Down

0 comments on commit 46de6e7

Please sign in to comment.