class PictureFrom::Apis::FacebookApi

Public Instance Methods

image_url_by_username(username) click to toggle source

TODO: Use the graph.facebook.com/karreiro/picture?redirect=false API to identify silhouette pictures.

# 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