Class: SocialProfile::Providers::Odnoklassniki
- Inherits:
-
Base
- Object
- Base
- SocialProfile::Providers::Odnoklassniki
show all
- Defined in:
- lib/social_profile/providers/odnoklassniki.rb
Instance Attribute Summary
Attributes inherited from Base
#auth_hash
Instance Method Summary
collapse
Methods inherited from Base
#access_token, #avatar_url, #credentials, #email, #extra, #extra?, #first_name, #info, #info?, #initialize, #last_name, #name, #nickname, #provider, #token_expires_at, #uid, #works?
Instance Method Details
#birthday ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 33
def birthday
@birthday ||= begin
Date.strptime(('raw_info')['birthday'],'%m/%d/%Y')
rescue Exception => e
nil
end
end
|
#city_name ⇒ Object
41
42
43
44
45
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 41
def city_name
@city_name ||= begin
location('city')
end
end
|
#gender ⇒ Object
0 - unknown 1 - female 2 - male Возвращаемые значения: 1 - женский, 2 - мужской, 0 - без указания пола.
25
26
27
28
29
30
31
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 25
def gender
@gender ||= case ('raw_info')['gender']
when 'male' then 2
when 'female' then 1
else 0
end
end
|
#location(key) ⇒ Object
51
52
53
54
55
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 51
def location(key)
if location? && Utils.exists?(('raw_info')['location'][key])
('raw_info')['location'][key]
end
end
|
#location? ⇒ Boolean
47
48
49
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 47
def location?
raw_info? && ('raw_info')['location'] && ('raw_info')['location'].is_a?(Hash)
end
|
#picture_url ⇒ Object
7
8
9
10
11
12
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 7
def picture_url
@picture_url ||= begin
url = info('image').gsub("photoType=4", "photoType=3")
check_url(url)
end
end
|
#profile_url ⇒ Object
14
15
16
17
18
19
|
# File 'lib/social_profile/providers/odnoklassniki.rb', line 14
def profile_url
@profile_url ||= begin
urls = info('urls')
urls.nil? ? nil : urls['Odnoklassniki']
end
end
|