Skip to content

Commit

Permalink
updated hash valus
Browse files Browse the repository at this point in the history
  • Loading branch information
gacha committed May 17, 2011
1 parent 3be1f83 commit 36d35f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions oa-more/lib/omniauth/strategies/draugiem.rb
Expand Up @@ -47,8 +47,8 @@ def callback_phase
if request.params['dr_auth_status'] == 'ok' && request.params['dr_auth_code']
response = RestClient.get('http://api.draugiem.lv/json/', { :params => draugiem_authorize_params(request.params['dr_auth_code']) })
auth = MultiJson.decode(response.to_s)
unless auth['error']
@auth_data = auth
unless auth['error']
@auth_data = auth
super
else
fail!(auth['error']['code'].to_s,auth["error"]["description"].to_s)
Expand Down Expand Up @@ -82,8 +82,8 @@ def get_user_info
'first_name' => user['name'],
'last_name' => user['surname'],
'location' => user['place'],
'age' => user['age'],
'adult' => user['adult'],
'age' => user['age'] =~ /^0-9$/ ? user['age'] : nil,
'adult' => user['adult'] == '1' ? true : false,
'image' => user['img'],
'sex' => user['sex']
}
Expand Down
2 changes: 2 additions & 0 deletions oa-more/spec/omniauth/strategies/draugiem_spec.rb
Expand Up @@ -44,6 +44,8 @@ def strategy

last_request.env['omniauth.auth']['credentials']['apikey'].should == "123456789"
last_request.env['omniauth.auth']['user_info']['location'].should == "Durbe"
last_request.env['omniauth.auth']['user_info']['age'].should be_nil
last_request.env['omniauth.auth']['user_info']['adult'].should be_true
end
end
end

0 comments on commit 36d35f0

Please sign in to comment.