Class: SocialProfile::Providers::Vkontakte

Inherits:
Base
  • Object
show all
Defined in:
lib/social_profile/providers/vkontakte.rb

Instance Attribute Summary

Attributes inherited from Base

#auth_hash

Instance Method Summary collapse

Methods inherited from Base

#access_token, #avatar_url, #birthday, #city_name, #credentials, #email, #extra, #extra?, #first_name, #info, #info?, #initialize, #last_name, #name, #nickname, #provider, #token_expires_at, #uid, #works?

Constructor Details

This class inherits a constructor from SocialProfile::Providers::Base

Instance Method Details

#genderObject

Возвращаемые значения: 1 - женский, 2 - мужской, 0 - без указания пола.



22
23
24
# File 'lib/social_profile/providers/vkontakte.rb', line 22

def gender
  @gender ||= (extra('raw_info')['sex'] || 0).to_i
end

#picture_urlObject



4
5
6
7
8
9
10
11
# File 'lib/social_profile/providers/vkontakte.rb', line 4

def picture_url
  @picture_url ||= begin
    if auth_hash['extra'] && info = auth_hash['extra']['raw_info']
      photo = info['photo_big'] || info['photo_200_orig']
      Utils.blank?(photo) ? nil : photo
    end
  end
end

#profile_urlObject



13
14
15
16
17
18
# File 'lib/social_profile/providers/vkontakte.rb', line 13

def profile_url
  @profile_url ||= begin
    urls = info('urls')
    urls.nil? ? nil : urls['Vkontakte']
  end
end