Changing gmail settings with Ruby
I need to set up my Gmail account programmatically using Ruby. I checked the api apps and it looks like the simplest solution would be to use ClientLogin for login and a simple XML PUT to change the forwarding setting eg.
I wrote a small test script like this:
It looks like the ClientLogin call works because it returns with an Auth = token. However, when it sends a PUT request to google, it returns with a RestClient :: Unauthorized exception. I rewrote the script with pure net / https and it turned out that the message I receive is an invalid token, but I can't figure out what is wrong with my token. Can anyone else see it?
a source to share
I noticed that you are using service = mail in your ClientLogin script. The correct value to use for the Email Settings API is service = apps. Also, use accountType = HOSTED instead of accountType = Google.
Are you using a Google Apps domain administrator to submit your requests? The Email Settings API can only be used by domain administrators and only in Google Apps for business, education, and ISPs.
a source to share