Permalink
Browse files

extracted method

  • Loading branch information...
gacha committed May 16, 2011
1 parent 559563a commit 9cd749f447ce76ef53abb1f0bb1d906783c7b05e
Showing with 14 additions and 11 deletions.
  1. +14 −11 oa-more/lib/omniauth/strategies/draugiem.rb
@@ -51,7 +51,20 @@ def callback_phase
end
def auth_hash
- user_info = if @auth_data['users'][@auth_data['uid']]
+ OmniAuth::Utils.deep_merge(super, {
+ 'uid' => @auth_data['uid'],
+ 'user_info' => get_user_info,
+ 'credentials' => {
+ 'apikey' => @auth_data['apikey']
+ },
+ 'extra' => { 'user_hash' => @auth_data }
+ })
+ end
+
+ private
+
+ def get_user_info
+ if @auth_data['users'] && @auth_data['users'][@auth_data['uid']]
user = @auth_data['users'][@auth_data['uid']]
{
'name' => "#{user['name']} #{user['surname']}",
@@ -67,17 +80,7 @@ def auth_hash
else
{}
end
- OmniAuth::Utils.deep_merge(super, {
- 'uid' => @auth_data['uid'],
- 'user_info' => user_info,
- 'credentials' => {
- 'apikey' => @auth_data['apikey']
- },
- 'extra' => { 'user_hash' => @auth_data }
- })
end
-
- private
def draugiem_authorize_params code
{

0 comments on commit 9cd749f

Please sign in to comment.