nil的未定义方法'+':NilClass(当尝试验证REST令牌接受时)

时间:2016-03-02 09:48:20

标签: ruby-on-rails rest magento oauth token

我正在尝试使用Ruby oauth客户端验证Magento REST Api令牌。 我正在使用Windows 7,Ruby 2.2.0(在Ubuntu远程服务器上托管的Magento 1.7.0.2)。

1)我通过CLI执行以下命令:

oauth --verbose --query-string --consumer-key ABCD --consumer-secret ABCD --access-token -url https://www.mywebsite.com/ch_fr/oauth/token --authorize-url https://www.mywebsite.com/ch_fr/admin/oauth_authorize --request-token-url mywebsite.com/ch_fr/oauth/initiate authorize

注意:我的命令中的网址都以“https://www”开头(我在stackoverflow上的低代表阻止我发布超过2个网址)。

2)ruby客户端显示以下消息:

Server appears to support OAuth 1.0a; enabling support.
Please visit this url to authorize:
https://www.mywebsite.com/ch_fr/admin/oauth_authorize?oauth_token=ABCD
Please enter the verification code provided by the SP (oauth_verifier):

3)成功连接到oauth_authorize网址后,登录,接受令牌并接收验证码,我在shell中填写代码Windows +按Enter键。

然后,这是我的问题,出现以下消息:

RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:1532:in `addr_port': undefined method `+' for nil:NilClass (NoMet
Error)
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:1465:in `begin_transport'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:1410:in `transport_request'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:1384:in `request'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:1377:in `block in request'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:853:in `start'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:1375:in `request'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/oauth-0.5.1/lib/oauth/consumer.rb:161:in `request'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/oauth-0.5.1/lib/oauth/consumer.rb:195:in `token_reques

     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/oauth-0.5.1/lib/oauth/tokens/request_token.rb:20:in `g
access_token'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/oauth-0.5.1/lib/oauth/cli.rb:80:in `execute'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/oauth-0.5.1/lib/oauth/cli.rb:19:in `execute'
     from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/oauth-0.5.1/bin/oauth:5:in `<top (required)>'
     from C:/RailsInstaller/Ruby2.2.0/bin/oauth:23:in `load'
     from C:/RailsInstaller/Ruby2.2.0/bin/oauth:23:in `<main>'

我的Magento服务器发送的内容是否被Ruby错误地接收(例如“nil”值)? 验证程序代码是否未正确发送到我的Magento服务器? 或者我的Ruby安装有问题吗? 另一点?

注2:我是Ruby的新手;)

任何帮助都会受到赞赏。 Thx提前。

0 个答案:

没有答案