Permalink
Browse files

updated hash valus

  • Loading branch information...
1 parent 3be1f83 commit 36d35f0e06e714166d42c989d3a965c539ce58aa @gacha gacha committed May 17, 2011
@@ -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)
@@ -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']
}
@@ -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.