Module: Avataree::ProfileServices
- 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.
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)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/avataree/profile.rb', line 42 def gravatar_profile(email, = {}) services_url = ([:secure] ? Helper.secure_url_services : Helper.url_services) and .delete(:secure) email = make_digest(email) email << ".json" params = .to_param unless .empty? resulted_path = [services_url, email].join path = [resulted_path, params].compact.join("?") 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 |