module Avataree::ProfileServices

Public Instance Methods

gravatar_profile(email, options = {}) click to toggle source

options:

<tt>secure</tt> takes boolean values to use https or not :default => false
this method returns hash full of information provided by Gravatar.
This hash may contain
Email address marked up with class=email (only available via JS/client-side parsing due to spam-protection measures)
IM accounts (some values only available via JS/client-side parsing due to spam-protection measures)
Phone numbers
Verified accounts
Name
Personal Links
Image (main Gravatar)
# File lib/avataree/profile.rb, line 44
def gravatar_profile(email, options = {})
  services_url = Helper.url_for_request(options.delete(:secure))
  email = make_digest(email)
  email << ".json"
  resulted_path = [services_url, email].join
  path = prepare_url_with_params(resulted_path, options)
  begin
    JSON.parse(open(path).read)
  rescue => e
    {"error" => "unable to parse", "description" => "either no such user is found on gravatar using
       provided email or some server side error. do check it out.", "errorTrace" => "#{e}"}
  end
end