我正在尝试制作一个 Ruby 控制台脚本来进行 namecheap API 调用。我找到了namecheap gem 并使用sudo gem install namecheap
.
我编写了我的测试脚本,隐藏了密钥、用户名和 clientip:
#!/usr/bin/env ruby
require 'namecheap'
Namecheap.configure do |config|
config.key = 'mykey'
config.username = 'myusername'
config.client_ip = 'myip'
end
Namecheap.domains.get_list
我的红宝石版本:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
运行脚本时出现此错误:
/var/lib/gems/1.9.1/gems/namecheap-0.1.2/lib/monkey_patch.rb:14:in `block in to_param': undefined method `to_query' for "myusername":String (NoMethodError)
from /var/lib/gems/1.9.1/gems/namecheap-0.1.2/lib/monkey_patch.rb:13:in `each'
from /var/lib/gems/1.9.1/gems/namecheap-0.1.2/lib/monkey_patch.rb:13:in `collect'
from /var/lib/gems/1.9.1/gems/namecheap-0.1.2/lib/monkey_patch.rb:13:in `to_param'
from /var/lib/gems/1.9.1/gems/namecheap-0.1.2/lib/namecheap/api.rb:15:in `api_call'
from /var/lib/gems/1.9.1/gems/namecheap-0.1.2/lib/namecheap/domains.rb:5:in `get_list'
from ./chkdn.rb:15:in `<main>'
知道有什么问题吗?