我有两种方法,一种方法标题def suche(ins)
以某种方式引发了这个错误:
syntax error, unexpected '(', expecting ';' or '\n'
def suche(ins)
我是初学者,并没有真正理解我做错了什么!我希望有人可以帮助我!非常感谢
我的整个代码:
class User
attr_accessor :username, :password, :uid, :private_key, :csr, :certificate
def initialize(username, password, uid, private_key=nil, csr=nil, certificate=nil)
@username = username
@password = password
@uid = uid
@private_key = "C:/Sites/keys/#{@username}private.pem"
@csr = "C:/Sites/keys/#{@username}csr.pem"
@certificate = certificate
end
def send(req,ww,text1=nil,text2=nil)
@conn = Faraday.new 'https://zombo.de/rest', :ssl => {:verify => false}
@conn.basic_auth(@username,@password)
@res = @conn.send(req) do |request|
request.url ww
request.headers['Content-Type'] = text1 unless text1 == nil
request.body = text2 unless text2 == nil
end
puts @res.body
end
def login
send('get',"login/#{@username}")
end
def change_password(newpass)
send('post',"accounts/#{@uid}/password",'text/plain',"#{newpass}")
def
def suche(ins)
send('get',"accounts/?search=#{ins}")
end
def send_csr
send('post','csr','text/plain',"#{File.read(@csr[0..-5])}")
end
def get_certificate
send('get',"accounts/#{@uid}/certificate")
end
end
user1 = User.new('john','AAasfsd','896242ß34ß')
user1.get_certificate