我是编程的初学者,我稍微更改了我的代码,以便我可以从命令行执行一些 def。在那次更改之后,我收到了一个错误,但首先是我的代码:
require 'faraday'
@conn = Faraday.new 'https://zombost.de:8673/rest', :ssl => {:verify => false}
@uid = '8978'
def certificate
res = conn.get do |request|
request.url "acc/#{@uid}/cere"
end
end
def suchen(input)
@suche = input
@res = @conn.get do |request|
request.url "acc/?search=#{@suche}"
end
end
puts @res.body
然后我在控制台中写道:
ruby prog.rb suchen(jumbo)
所以,不知何故我得到了错误:
Undefined method body for Nilclass