Module: Avataree::Profile
- Defined in:
- lib/avataree/profile.rb
Constant Summary collapse
- PROFILE_PATH =
image path for gravatar if not defined?
"http://www.gravatar.com/"
Instance Method Summary collapse
-
#gravatar_profile(email, options = {}) ⇒ Object
this method returns hash full of information provided by Gravatar.
Instance Method Details
#gravatar_profile(email, options = {}) ⇒ Object
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)
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/avataree/profile.rb', line 43 def gravatar_profile(email, = {}) email = make_digest(email) email << ".json" params = .to_param unless .empty? resulted_path = PROFILE_PATH.dup << email 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 |