Class: SocialProfile::Providers::Facebook
- Inherits:
-
Base
- Object
- Base
- SocialProfile::Providers::Facebook
show all
- Defined in:
- lib/social_profile/providers/facebook.rb
Instance Attribute Summary
Attributes inherited from Base
#auth_hash
Instance Method Summary
collapse
Methods inherited from Base
#access_token, #avatar_url, #city_name, #credentials, #email, #extra, #extra?, #first_name, #info, #info?, #initialize, #last_name, #name, #nickname, #provider, #token_expires_at, #uid
Instance Method Details
#birthday ⇒ Object
34
35
36
37
38
39
40
|
# File 'lib/social_profile/providers/facebook.rb', line 34
def birthday
@birthday ||= begin
Date.strptime(('raw_info')['birthday'],'%m/%d/%Y')
rescue Exception => e
nil
end
end
|
#gender ⇒ Object
0 - unknown 1 - female 2 - male Возвращаемые значения: 1 - женский, 2 - мужской, 0 - без указания пола.
26
27
28
29
30
31
32
|
# File 'lib/social_profile/providers/facebook.rb', line 26
def gender
@gender ||= case ('raw_info')['gender']
when 'male' then 2
when 'female' then 1
else 0
end
end
|
#picture_url ⇒ Object
8
9
10
11
12
13
|
# File 'lib/social_profile/providers/facebook.rb', line 8
def picture_url
@picture_url ||= begin
url = info('image').split('?').shift()
check_url([url, "type=large"].join('?'))
end
end
|
#profile_url ⇒ Object
15
16
17
18
19
20
|
# File 'lib/social_profile/providers/facebook.rb', line 15
def profile_url
@profile_url ||= begin
urls = info('urls')
urls.nil? ? nil : urls['Facebook']
end
end
|
#works ⇒ Object
46
47
48
49
|
# File 'lib/social_profile/providers/facebook.rb', line 46
def works
return [] unless works?
@works ||= ('raw_info')['work']
end
|
#works? ⇒ Boolean
42
43
44
|
# File 'lib/social_profile/providers/facebook.rb', line 42
def works?
raw_info? && ('raw_info')['work'] && ('raw_info')['work'].is_a?(Array)
end
|