我想使用 ruby gem 'twitter' 但由于未知原因它不起作用。这是我在运行脚本时遇到的错误:
C:/nwcloud/jruby-1.7.2/lib/ruby/gems/shared/gems/faraday-0.8.6/lib/faraday/reques/multipart.rb:5 warning: already initialized constant DEFAULT_BOUNDARY
Twitter::Error::ClientError: initialize: name or service not known
request at C:/nwcloud/jruby-1.7.2/lib/ruby/gems/shared/gems/twitter-4.5.0/lib/twitter/client.rb:85
get at C:/nwcloud/jruby-1.7.2/lib/ruby/gems/shared/gems/twitter-4.5.0/lib/twitter/client.rb:64
__send__ at org/jruby/RubyBasicObject.java:1671
send at org/jruby/RubyKernel.java:2094
cursor_from_response at C:/nwcloud/jruby-1.7.2/lib/ruby/gems/shared/gems/twitter-4.5.0/lib/twitter/api/utils.rb:108
cursor_from_response_with_user at C:/nwcloud/jruby-1.7.2/lib/ruby/gems/shared/gems/twitter-4.5.0/lib/twitter/api/utils.rb:96
friends at C:/nwcloud/jruby-1.7.2/lib/ruby/gems/shared/gems/twitter-4.5.0/lib/twitter/api/friends_and_followers.rb:314
(root) at tCon.rb:11
我在我的 twitter 开发者帐户中注册了我的应用程序并安装了 gem。这是我的编码(我删除了所有键):
需要“推特”
客户 = Twitter::Client.new(
:consumer_key => "",
:consumer_secret => "",
:oauth_token => "",
:oauth_token_secret => ""
)
client.update("我正在用@gem 发推文!")`
我也试着这样做:
Twitter.configure 做 |config|
config.consumer_key = YOUR_CONSUMER_KEY
config.consumer_secret = YOUR_CONSUMER_SECRET
config.oauth_token = YOUR_OAUTH_TOKEN
config.oauth_token_secret = YOUR_OAUTH_TOKEN_SECRET
结尾
..它不起作用:-( ..我是红宝石的新手,所以也许我忘了……我真的很期待你的回答。提前谢谢你!!!