package com.blogspot.diegopacheco.httpbuildergroovytwitter.model import groovyx.net.http.HTTPBuilder import static groovyx.net.http.Method.* import static groovyx.net.http.ContentType.* /** * Script Groovy que atualiza seu stuts no Twitter via HttpBuilder pelo console. * Sendo que você executa assim: groovy updateConsoleTwitter.groovy usuario senha "texto" * * @author Diego Pacheco * @version 1.0 * @since 30/03/2009 * */ public class updateConsoleTwitter{ public static void main(String []args){ def http = new HTTPBuilder('http://twitter.com/statuses/') http.auth.basic args[0],args[1] http.request( POST, XML ) { req -> uri.path = 'update.xml' send URLENC, [status: args[2] , source:'httpbuilder'] req.params.setBooleanParameter 'http.protocol.expect-continue', false response.success = { resp, xml -> assert resp.statusLine.statusCode == 200 println "Update realizado com sucesso!" } } } }