Google Analytics and Gdata

Hello all

in my app I have link "Authorize me to access your Google Analytics

so user will click this link..

1.if user is logged into Google account it will show a screen with my
email id prefilled in authorization section and I will be created as a
read-only user to access Analytics data.

2. otherwise it will popup login screen and rest of the functionality
similar as step 1.

I am using Gdata gem in my app.

Can you someone help me with a simple example, please?