简体   繁体   English

使用twitter gem,如何从Twitter :: REST转发Twitter :: Tweet:Tweets.retweet?

[英]With the twitter gem, how do I retweet a Twitter::Tweet from Twitter::REST:Tweets.retweet?

I have an instance of Twitter::Tweet, which does not have a method retweet. 我有一个Twitter :: Tweet的实例,它没有转发方法。 ( http://www.rubydoc.info/gems/twitter/Twitter/Tweet ) http://www.rubydoc.info/gems/twitter/Twitter/Tweet

However, Twitter::REST::Tweets does have a method I can use to retweet. 但是,Twitter :: REST :: Tweets确实有一个我可以用来转推的方法。 ( http://www.rubydoc.info/gems/twitter/Twitter/REST/Tweets#retweet-instance_method ) http://www.rubydoc.info/gems/twitter/Twitter/REST/Tweets#retweet-instance_method

I can't find an example over at: https://github.com/sferik/twitter 我找不到一个例子: https//github.com/sferik/twitter

Any help appreciated. 任何帮助赞赏。 I've probably just left it too late at night to be figuring things out. 我可能只是太晚才把它弄清楚了。

Cheers, Ian. 干杯,伊恩。

Ok. 好。 So, you only ever figure it out a few minutes after sharing how rubbish you are with stackoverflow :) 所以,你在与stackoverflow分享你的垃圾之后几分钟才弄清楚:)

If you have an instance of Twitter::Tweet, and lets call that tweet, you can retweet it using the client. 如果您有Twitter :: Tweet的实例,并且让我们调用该推文,您可以使用客户端转发它。

So: 所以:

@client.retweet tweet

Will RT the tweet. 请转发推特。

I'll try and add this into the wiki for twitter-gem. 我会尝试将此添加到维基的twitter-gem中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM