1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00

Merge pull request #302 from heydiplo/master.

vkontakte empty response handling
This commit is contained in:
Michael Bleigh 2011-05-03 13:38:53 -07:00
commit ac27772dfd

View file

@ -36,10 +36,10 @@ module OmniAuth
# we need these 2 additional requests since vkontakte returns only ids of the City and Country
# http://vkontakte.ru/developers.php?o=-17680044&p=getCities
@city ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCities?cids=#{@data['city']}&access_token=#{@access_token.token}"))['response'][0]['name']
@city ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCities?cids=#{@data['city']}&access_token=#{@access_token.token}"))['response'].try(:[], 0).try(:[], 'name')
# http://vkontakte.ru/developers.php?o=-17680044&p=getCountries
@country ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCountries?cids=#{@data['country']}&access_token=#{@access_token}"))['response'][0]['name']
@country ||= MultiJson.decode(@access_token.get("https://api.vkontakte.ru/method/getCountries?cids=#{@data['country']}&access_token=#{@access_token}"))['response'].try(:[], 0).try(:[], 'name')
end
def request_phase