Class: PictureFrom::Apis::FacebookApi
- Inherits:
-
Object
- Object
- PictureFrom::Apis::FacebookApi
- Defined in:
- lib/picture_from/apis/facebook_api.rb
Instance Method Summary collapse
-
#image_url_by_username(username) ⇒ Object
TODO: Use the graph.facebook.com/karreiro/picture?redirect=false API to identify silhouette pictures.
Instance Method Details
#image_url_by_username(username) ⇒ Object
TODO: Use the graph.facebook.com/karreiro/picture?redirect=false API to identify silhouette pictures.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/picture_from/apis/facebook_api.rb', line 10 def image_url_by_username(username) url = "http://graph.facebook.com/#{username}/picture" open URI.escape(url) rescue OpenURI::HTTPError # handle 404 and 400 nil rescue RuntimeError # handle 302 url end |