groovy-twitter


A Groovy wrapper for the Twitter API

Groovy Twitter

groovy-twitter is a Groovy wrapper for the Twitter API.

Building

In progress with Gant and Gradle

Using

API:

The API is exposed through the groovyx.twitter.Twitter class. To create an instance of Twitter using the groovysh:

``` Leopard:~/groovy-twitter alleon$ groovysh Groovy Shell (1.5.6, JVM: 1.5.0_13-119)

Type 'help' or '\h' for help.

groovy:000> twitter = new Twitter("guillaume.alleon@gmail.com", "****") ===> groovyx.twitter.Twitter@ee4c6 ```

To fetch a user's profile:

groovy:000> u = twitter.getUser("glaforge") ===> 14441858Guillaume LaforgeglaforgeParisGroovy lead ... groovy:000> println "Id of glaforge = ${u.id}" Id of glaforge = 14441858 ===> null

To fetch a single user's public status messages, where "user" is a Twitter user id:

groovy:000> t = twitter.getFriendsTimeline(u) ===> [Sun May 04 07:51:33 +0000 2008803072576GMaven 1.0-rc-1 is released ... groovy:000> t.each{println "by ${it.user.name} : ${it.text}"} by jasondillon : GMaven 1.0-rc-1 is released! by Bernard Notarianni : Aller, je vais preparer le ptit dej! ... by Duncan Davidson : wanting to whine about baggage wait at SFO but trying not to. Mostly because I could have used this time to pick up decent food.

To fetch the tweets of the authetified user: x = twitter.tweets ===> [Sun May 04 06:46:09 +0000 2008803052090Post Update from groovysh using groovy-twitter ... groovy:000> x.each{println it} Sun May 04 06:46:09 +0000 2008803052090Post Update from groovysh using groovy-twitter ...

To end the connection: groovy:000> twitter.logoff() ===> true

Todo

Add more example scripts.

Add tests.

More Information

Please visit http://groups.google.com/group/groovy-twitter for more discussion.

Contributors

Most welcome.

License

``` Copyright 2008 Guillaume Alleon. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```

Project Information

Labels:
groovy twitter