使用以下Ruby代码,我可以通过Twitter API向我的帐户发送状态更新。根据{{3}},我希望它可以进行地理编码,但事实并非如此。我做错了什么?
require 'oauth'
consumer = OAuth::Consumer.new('<MY_CONSUMER_KEY>', '<MY_CONSUMER_SECRET>', :site => "http://api.twitter.com", :scheme => :header)
access_token = OAuth::AccessToken.from_hash(consumer, :oauth_token => '<MY_OAUTH_TOKEN>', :oauth_token_secret => '<MY_OAUTH_SECRET>')
access_token.request(:post, "http://api.twitter.com/1/statuses/update.xml", {"Content-Type" => "application/xml", "status" => "This Tweet is from Zuerich in Switzerland", "lat" => "47.3807", "long" => "8.537", "display_coordinates" => "true", "geo_enabled" => "true"})
答案 0 :(得分:1)
一切正常。您应该在Twitter配置文件设置中启用"Add a location to your tweets"
。