lib/social_profile/providers/facebook.rb in social_profile-0.1.3 vs lib/social_profile/providers/facebook.rb in social_profile-0.1.4
- old
+ new
@@ -1,6 +1,7 @@
# encoding: utf-8
+
module SocialProfile
module Providers
class Facebook < Base
# http://developers.facebook.com/docs/reference/api/#pictures
#
@@ -35,10 +36,19 @@
Date.strptime(extra('raw_info')['birthday'],'%m/%d/%Y')
rescue Exception => e
nil
end
end
+
+ def works?
+ raw_info? && extra('raw_info')['work'] && extra('raw_info')['work'].is_a?(Array)
+ end
+
+ def works
+ return [] unless works?
+ @works ||= extra('raw_info')['work']
+ end
protected
def check_url(url)
response = Utils.head(url, :follow_redirects => false)
@@ -48,8 +58,11 @@
else
url
end
end
+ def raw_info?
+ extra('raw_info') && extra('raw_info').is_a?(Hash)
+ end
end
end
end