Module: Avataree::ProfileServices
- Includes:
- Helper
- Defined in:
- lib/avataree/profile.rb
Instance Method Summary collapse
-
#gravatar_profile(email, options = {}) ⇒ Object
options:
secure
takes boolean values to use https or not :default => false this method returns hash full of information provided by Gravatar.
Methods included from Helper
#get_params, included, #make_digest, #prepare_url_with_params, url_for_request
Instance Method Details
#gravatar_profile(email, options = {}) ⇒ Object
options: secure
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)
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/avataree/profile.rb', line 44 def gravatar_profile(email, = {}) services_url = Helper.url_for_request(.delete(:secure)) email = make_digest(email) email << ".json" resulted_path = [services_url, email].join path = prepare_url_with_params(resulted_path, ) 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 |