问题
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