module Looks::Gravatar

Constants

API_URL
DEFAULT_API_URL
DEFAULT_DOWNLOAD_URL
DOWNLOAD_URL

Public Class Methods

get(email) click to toggle source
# File lib/looks/gravatar.rb, line 19
def self.get(email)
  Net::HTTP.get(URI("#{DOWNLOAD_URL}/#{hash(email)}.jpg"))
end
hash(email) click to toggle source
# File lib/looks/gravatar.rb, line 23
def self.hash(email)
  Digest::MD5.hexdigest(email.strip.downcase)
end
url(email) click to toggle source
# File lib/looks/gravatar.rb, line 27
def self.url(email)
  "#{API_URL}?user=#{hash(email)}"
end