Veerasundaravel's Ruby on Rails Weblog

December 2, 2010

Gravatar Profile in Rails using gravatar_profile gem

Filed under: Gravatar — Tags: , , , , , , — Veerasundaravel @ 5:40 pm

This article is about getting Gravatar profile information like gravatar_image, profile_url and display name etc.,

Gravatar APIs require no authentication, you can get profile information by simple HTTP GET requests. You should pass the user email address to the API and the API will return the corresponding registered users details.


GravatarProfile Gem:

Here we are going the gem gravatar_profile to interact with Gravatar API.

gravatar_profile is a Ruby Wrapper for getting GRAVATAR avatars and profile informations.

By passing the user email you can get the gravatar image, gravatar profile url and as well as profile informations also.

gem install gravatar_profile


Getting Gravatar Image:

gravatar ="your-email-address")

>> ""


Getting Gravatar Profile Url:

gp ="your-email-address")

>> ""

gp.gravatar_profile_url(:filetype => :xml)
>> ""


Accessing profile informations:

#Accessing profile information is much simpler, just you need to call the function get_profile_info and it will return entire information of the gravatar user as a hash.

gp ="some-email-address")

#It will return a collection of profile information as Hash from gravatar.

#If your server need to use proxyy means specify the proxy details as follows.
gp.get_profile_info({:proxy_host => '', :proxy_port=>8000})

>> {"name"=>[{"givenName"=>["User-GivenName"], "familyName"=>["FamilyName"], "formatted"=>["User-GivenName Lastname"]}], "requestHash"=>["6fa14cea067256804121f81c33d5fbb"], "preferredUsername"=>["user-givenname"], "displayName"=>["user-givenname"], "thumbnailUrl"=>[""], "hash"=>["6fadss14cea0167256804121f81c33d5fbb"], "urls"=>[{"value"=>[""]}, {"title"=>["Ruby on Rails Weblog"], "value"=[""]}, {"title"=>["Twitter Account"], "value"=>[""]}], "ims"=>[{"type"=>["yahoo"], "value"=>["some-name2003"]} {"type"=>["gtalk"], "value"=>["some-name2003"]}, {"type"=>["skype"], "value"=>["user-givenname"]}], "emails"=>[{"primary"=>["true"], "value"=>[""]}], "photos">[{"type"=>["thumbnail"], "value"=>[""]}, {"value"=>[""]}], "id"=>["5146707"], "accounts"=>[{"shortname"=>["facebook"], "url"=>[""], "username"=>[""], "domain"=>["], "display"=>[""], "verified"=>["true"]}, {"shortname"=>["linkedin"], "url"=>[""], "username"=>["usernameel"], "domain"=>[""], "display"=>["user-givenname"], "verified"=>["true"]}, {"shortname"=>["twitter"], "url"=>[""], "username"=>["eerasundaravel"], "domain"=>[""], "display"=>["@user-givenname"], "verified"=>["true"]}, {"shortname"=>["wordpress"], "url"=>["", "username"=>[""], "domain"=>[""], "display"=>[""], "verified"=>["true"]}], "currentLocaton"=>["Location1, Country"], "aboutMe"=>["About me text goes here"], "phoneNumbers"=>[{"type"=>["mobile"], "value"=>["9894873774"]}], "profileUrl"=>[""]}


  1. Awesome Awesome

    Comment by Srikanth — December 2, 2010 @ 6:14 pm

  2. how are you I was fortunate to seek your blog in digg
    your subject is quality
    I get a lot in your topic really thanks very much
    btw the theme of you site is really exceptional
    where can find it

    Comment by bet365 — December 15, 2010 @ 5:43 pm

  3. Good post. I will be experiencing some of these issues as well..

    Comment by health articles — October 28, 2014 @ 11:26 pm

RSS feed for comments on this post. TrackBack URI

Leave a Reply to Srikanth Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: