2013-03-11 58 views
1

我试图从API使用Ruby获取Twitter收藏夹的基本列表,但我一直在碰撞这个错误。使用Twitter API时未定义的方法encode_www_form

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)错误。

+0

是否要求 'URI'? – leifg 2013-03-11 17:36:31

+0

是的,但没有区别。 – 2013-03-11 20:11:23

回答

0

用途:

URI.encode_www_form_component(yourStringToEncodeHere) 
+0

我也试过,但没有奏效。我发现问题是我忘记了最后一次,在10以后和结束之前)。 – 2013-03-13 16:19:14

相关问题