Changing gmail Settings with Ruby

Posted by Technocrat on Stack Overflow See other posts from Stack Overflow or by Technocrat
Published on 2010-04-21T05:29:56Z Indexed on 2010/04/21 5:33 UTC
Read the original article Hit count: 198

Filed under:
|
|

I need to configure my gmail account(s) programmatically with Ruby. I checked out the apps api and it looks like the simplest possible solution would be to use ClientLogin for logging in and a simple XML PUT for changing the forwarding setting, for example.

I wrote a little test script like so:

http://gist.github.com/373457

It would appear that the call to ClientLogin works because it comes back with an Auth= token. When it sends the PUT request to google, however, it comes back with a RestClient::Unauthorized exception. I rewrote the script with pure net/https and it turns out the message I'm getting is invalid token, yet I can't figure out what is wrong with my token. Can anyone else see it?

© Stack Overflow or respective owner

Related posts about gmail

Related posts about google-api