Hello all,
I’m pretty new to Ruby, I’m trying to Post with Parameter however I keep
getting a “wrong number of Arguments” error? can someone tell me where
I’m going wrong?
code:
require “uri”
require “net/http”
vin=ARGV[0]
params =
{‘partnerCode’=>‘CAR’,‘partnerSiteLocation’=>5,‘checkReport’=>‘DEC’,
‘checkReportVersion’=>30,‘vin’=>vin
}
x =
Net::HTTP.post_form(URI.parse(“Free VIN Check from CARFAX”),
params)
puts x.body
rb(main):010:0> Ruby test.rb <<this is how I am running the script
ArgumentError: wrong number of arguments (0 for 2…3)
from (irb):10:in test' from (irb):10 from C:/Ruby22/bin/irb:11:in
’
irb(main):011:0>
Method Kernel#test needs 2 to 3 arguments.
See Module: Kernel (Ruby 2.3.0)
You are providing no arguments. If you enter “ruby test.rb”, it is
interpreted as ruby code:
ruby(test().rb)
First the argument gets evaluated, and the method Kernel#test is called.
Which results in the error you got.
If you want to run your script, enter
ruby test.rb
on the command line, not within irb (ruby’s interactive shell).
I managed to figure it out
ruby.exe myscript.rb myparm
One last question now that I see the full html, how would I display only
what I need from the html ?
thank you so much for all the help ?