我提出了一个问题,如何捕获来自 twitter.com 的响应?( ruby + twitter gem)知道我的更新是否成功。它工作正常...
但我想知道如何在我的 ruby 代码中捕获HTTP 响应代码和错误?
oauth = Twitter::OAuth.new('consumer token', 'consumer secret')
oauth.authorize_from_access('access token', 'access secret')
client = Twitter::Base.new(oauth)
response = client.update('Heeeyyyyoooo from Twitter Gem!')