使用Twitter API时未定义的方法encode_www_form

时间:2013-03-11 17:30:05

标签: ruby json api twitter

我正在尝试使用Ruby从API中获取Twitter收藏的基本列表,但我一直对这个错误表示不满。

baseurl = "https://api.twitter.com"
path    = "/1.1/favorites/list.json"
query   = URI.encode_www_form(
            "screen_name" => "twitterapi",
            "count" => 10)
address = URI("#{baseurl}#{path}#{query}")

每次运行时我都会遇到undefined method encode_www_form for URI:Module (NoMethodError)错误。

1 个答案:

答案 0 :(得分:0)

使用:

URI.encode_www_form_component(yourStringToEncodeHere)