To pass parameters with a ruby ββborder, you can use
Curl::postalize(params)
These functions actually return to URI.encode_www_form (params) in the curb gem implementation. https://github.com/taf2/curb/blob/f89bb4baca3fb3482dfc26bde8f0ade9f1a4b2c2/lib/curl.rb
An example of using this function will be
curl = Curl::Easy.new curl.url = "#{base_url}?#{Curl::postalize(params)}" curl.perform
To access the curl return line you can use.
data = curl.body_str
The second alternative would be
curl = Curl::Easy.new curl.url = Curl::urlalize(base_url, params) curl.perform data = curl.body_str
Note that Curl :: urlalize may be a bit erroneous, see this pull for postalize, which fixed this flaw, but urlalize still uses the old implementation.
source share