Created
September 3, 2011 08:11
-
-
Save fumokmm/1190848 to your computer and use it in GitHub Desktop.
Groovyでtwitter4jを使ってpostするサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 参考: http://d.hatena.ne.jp/irof/20110625/p1 | |
// http://twitter4j.org/ja/code-examples.html | |
@Grab('org.twitter4j:twitter4j-core:latest.integrated') | |
import twitter4j.* | |
import twitter4j.conf.* | |
def conf = new ConfigurationBuilder() | |
.setOAuthConsumerKey('consumer key') | |
.setOAuthConsumerSecret('consumer secret') | |
.setOAuthAccessToken('access token') | |
.setOAuthAccessTokenSecret('access token secret') | |
def twitter = new TwitterFactory(conf.build()).instance | |
def status = twitter.updateStatus('test') | |
println "Successfully updated the status to [${status.text}]." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment