How to create instance of Twitter::Tweet to create retweeted_by_user

廉价感情. 提交于 2019-12-25 07:39:47

问题


I want to call retweeted_by_user(user, options = {}). How do I create instance of object Twitter::Tweet (in Twitter::REST::Timelines module) to call this method. It is instance method, correct?

I did this for Twitter::REST::CLIENT

 client = client = Twitter::REST::Client.new do |config|
  config.consumer_key     = "..."
  config.consumer_secret  = "..."
  config.access_token     = "..."
  config.access_token_secret = "..."
end

but it does not work for Twitter::Tweet

 client = client = Twitter::Tweet.new do |config|
  config.consumer_key     = "..."
  config.consumer_secret  = "..."
  config.access_token     = "..."
  config.access_token_secret = "..."
end

Here are the docs for Twitter gem. I need a little more explanation http://rdoc.info/gems/twitter/Twitter/REST/Timelines#retweeted_by_user-instance_method


回答1:


spec are the best documentation and explanation:

client: https://github.com/sferik/twitter/blob/c9cfca9bf156ac0569d6c2cd7117327daf10a643/spec/twitter/rest/timelines_spec.rb#L6

method usage: https://github.com/sferik/twitter/blob/c9cfca9bf156ac0569d6c2cd7117327daf10a643/spec/twitter/rest/timelines_spec.rb#L58



来源:https://stackoverflow.com/questions/24727409/how-to-create-instance-of-twittertweet-to-create-retweeted-by-user

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!