和下面这段代码相同的ruby 怎么写呢?
public function makeRequest($url, $method, $postfields = NULL) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
if ('POST' === $method) {
curl_setopt($ch, CURLOPT_POST, 1);
if (!empty($postfields)) {
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
}
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->_connectTimeOut);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->_timeOut);
curl_setopt($ch, CURLOPT_USERAGENT, $this->_userAgent);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
THK