You can pass parameters as a string:
resource.get(params: 'p=1&p=2')
For example, using the restclient shell:
>> RestClient.log = Logger.new(STDOUT) #<Logger:0x007fa444cbecc0 @progname=nil, @level=0, @default_formatter=#<Logger::Formatter:0x007fa444cbec70 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x007fa444cbebd0 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDOUT>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x007fa444cbeba8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x007fa444cbeb58>>>> >> resource = RestClient::Resource.new( 'http://www.example.net' ) #<RestClient::Resource:0x007fa444c9fdc0 @url="http://www.example.net", @block=nil, @options={}> >> resource.get(params: 'p=1&p=2') RestClient.get "http://www.example.net", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Params"=>"p=1&p=2"
If you do not want to write code to create a string that you should avoid because it is not necessarily simple, let the Ruby URI class cobble it together:
require 'uri' URI::encode_www_form([['p', 1], ['p', 2]])
source share