Object
These integer codes are available in curl/curl.h
# File lib/typhoeus/easy.rb, line 73 73: def auth=(authinfo) 74: set_option(OPTION_VALUES[:CURLOPT_USERPWD], "#{authinfo[:username]}:#{authinfo[:password]}") 75: set_option(OPTION_VALUES[:CURLOPT_HTTPAUTH], authinfo[:method]) if authinfo[:method] 76: end
# File lib/typhoeus/easy.rb, line 78 78: def auth_methods 79: get_info_long(INFO_VALUES[:CURLINFO_HTTPAUTH_AVAIL]) 80: end
# File lib/typhoeus/easy.rb, line 110 110: def connect_timeout=(milliseconds) 111: @connect_timeout = milliseconds 112: set_option(OPTION_VALUES[:CURLOPT_NOSIGNAL], 1) 113: set_option(OPTION_VALUES[:CURLOPT_CONNECTTIMEOUT_MS], milliseconds) 114: end
# File lib/typhoeus/easy.rb, line 336 336: def curl_version 337: version 338: end
# File lib/typhoeus/easy.rb, line 150 150: def disable_ssl_peer_verification 151: set_option(OPTION_VALUES[:CURLOPT_VERIFYPEER], 0) 152: end
# File lib/typhoeus/easy.rb, line 90 90: def effective_url 91: get_info_string(INFO_VALUES[:CURLINFO_EFFECTIVE_URL]) 92: end
gets called when finished and response code is 300-599
# File lib/typhoeus/easy.rb, line 287 287: def failure 288: @failure.call(self) if @failure 289: end
# File lib/typhoeus/easy.rb, line 98 98: def follow_location=(boolean) 99: if boolean 100: set_option(OPTION_VALUES[:CURLOPT_FOLLOWLOCATION], 1) 101: else 102: set_option(OPTION_VALUES[:CURLOPT_FOLLOWLOCATION], 0) 103: end 104: end
# File lib/typhoeus/easy.rb, line 332 332: def get_info_double(option) 333: easy_getinfo_double(option) 334: end
# File lib/typhoeus/easy.rb, line 328 328: def get_info_long(option) 329: easy_getinfo_long(option) 330: end
# File lib/typhoeus/easy.rb, line 324 324: def get_info_string(option) 325: easy_getinfo_string(option) 326: end
# File lib/typhoeus/easy.rb, line 65 65: def headers=(hash) 66: @headers = hash 67: end
# File lib/typhoeus/easy.rb, line 303 303: def increment_retries 304: @retries ||= 0 305: @retries += 1 306: end
# File lib/typhoeus/easy.rb, line 106 106: def max_redirects=(redirects) 107: set_option(OPTION_VALUES[:CURLOPT_MAXREDIRS], redirects) 108: end
# File lib/typhoeus/easy.rb, line 308 308: def max_retries 309: @max_retries ||= 40 310: end
# File lib/typhoeus/easy.rb, line 312 312: def max_retries? 313: retries >= max_retries 314: end
# File lib/typhoeus/easy.rb, line 154 154: def method=(method) 155: @method = method 156: if method == :get 157: set_option(OPTION_VALUES[:CURLOPT_HTTPGET], 1) 158: elsif method == :post 159: set_option(OPTION_VALUES[:CURLOPT_HTTPPOST], 1) 160: self.post_data = "" 161: elsif method == :put 162: set_option(OPTION_VALUES[:CURLOPT_UPLOAD], 1) 163: self.request_body = "" unless @request_body 164: elsif method == :head 165: set_option(OPTION_VALUES[:CURLOPT_NOBODY], 1) 166: else 167: set_option(OPTION_VALUES[:CURLOPT_CUSTOMREQUEST], method.to_s.upcase) 168: end 169: end
# File lib/typhoeus/easy.rb, line 291 291: def on_failure(&block) 292: @failure = block 293: end
# File lib/typhoeus/easy.rb, line 295 295: def on_failure=(block) 296: @failure = block 297: end
# File lib/typhoeus/easy.rb, line 278 278: def on_success(&block) 279: @success = block 280: end
# File lib/typhoeus/easy.rb, line 282 282: def on_success=(block) 283: @success = block 284: end
# File lib/typhoeus/easy.rb, line 177 177: def params=(params) 178: @params = params 179: params_string = params.keys.collect do |k| 180: value = params[k] 181: if value.is_a? Hash 182: value.keys.collect {|sk| Rack::Utils.escape("#{k}[#{sk}]") + "=" + Rack::Utils.escape(value[sk].to_s)} 183: elsif value.is_a? Array 184: key = Rack::Utils.escape(k.to_s) 185: value.collect { |v| "#{key}=#{Rack::Utils.escape(v.to_s)}" }.join('&') 186: else 187: "#{Rack::Utils.escape(k.to_s)}=#{Rack::Utils.escape(params[k].to_s)}" 188: end 189: end.flatten.join("&") 190: 191: if method == :post 192: self.post_data = params_string 193: else 194: self.url = "#{url}?#{params_string}" 195: end 196: end
# File lib/typhoeus/easy.rb, line 254 254: def perform 255: set_headers() 256: easy_perform() 257: resp_code = response_code() 258: if resp_code >= 200 && resp_code <= 299 259: success 260: else 261: failure 262: end 263: resp_code 264: end
# File lib/typhoeus/easy.rb, line 171 171: def post_data=(data) 172: @post_data_set = true 173: set_option(OPTION_VALUES[:CURLOPT_POSTFIELDSIZE], data.length) 174: set_option(OPTION_VALUES[:CURLOPT_COPYPOSTFIELDS], data) 175: end
# File lib/typhoeus/easy.rb, line 69 69: def proxy=(proxy) 70: set_option(OPTION_VALUES[:CURLOPT_PROXY], proxy) 71: end
# File lib/typhoeus/easy.rb, line 130 130: def request_body=(request_body) 131: @request_body = request_body 132: if @method == :put 133: easy_set_request_body(@request_body) 134: headers["Transfer-Encoding"] = "" 135: headers["Expect"] = "" 136: else 137: self.post_data = request_body 138: end 139: end
# File lib/typhoeus/easy.rb, line 316 316: def reset 317: @retries = 0 318: @response_code = 0 319: @response_header = "" 320: @response_body = "" 321: easy_reset() 322: end
# File lib/typhoeus/easy.rb, line 94 94: def response_code 95: get_info_long(INFO_VALUES[:CURLINFO_RESPONSE_CODE]) 96: end
# File lib/typhoeus/easy.rb, line 299 299: def retries 300: @retries ||= 0 301: end
# File lib/typhoeus/easy.rb, line 266 266: def set_headers 267: headers.each_pair do |key, value| 268: easy_add_header("#{key}: #{value}") 269: end 270: easy_set_headers() unless headers.empty? 271: end
# File lib/typhoeus/easy.rb, line 246 246: def set_option(option, value) 247: if value.class == String 248: easy_setopt_string(option, value) 249: elsif value 250: easy_setopt_long(option, value) 251: end 252: end
Set SSL CACERT “ File holding one or more certificates to verify the peer with. “
# File lib/typhoeus/easy.rb, line 235 235: def ssl_cacert=(cacert) 236: set_option(OPTION_VALUES[:CURLOPT_CAINFO], cacert) 237: end
Set CAPATH “ directory holding multiple CA certificates to verify the peer with. The certificate directory must be prepared using the openssl c_rehash utility. “
# File lib/typhoeus/easy.rb, line 242 242: def ssl_capath=(capath) 243: set_option(OPTION_VALUES[:CURLOPT_CAPATH], capath) 244: end
Set SSL certificate “ The string should be the file name of your certificate. “ The default format is “PEM” and can be changed with ssl_cert_type=
# File lib/typhoeus/easy.rb, line 201 201: def ssl_cert=(cert) 202: set_option(OPTION_VALUES[:CURLOPT_SSLCERT], cert) 203: end
Set SSL certificate type “ The string should be the format of your certificate. Supported formats are “PEM” and “DER” “
# File lib/typhoeus/easy.rb, line 207 207: def ssl_cert_type=(cert_type) 208: raise "Invalid ssl cert type : '#{cert_type}'..." if cert_type and !%(PEM DER).include?(cert_type) 209: set_option(OPTION_VALUES[:CURLOPT_SSLCERTTYPE], cert_type) 210: end
Set SSL Key file “ The string should be the file name of your private key. “ The default format is “PEM” and can be changed with ssl_key_type=
# File lib/typhoeus/easy.rb, line 216 216: def ssl_key=(key) 217: set_option(OPTION_VALUES[:CURLOPT_SSLKEY], key) 218: end
# File lib/typhoeus/easy.rb, line 228 228: def ssl_key_password=(key_password) 229: set_option(OPTION_VALUES[:CURLOPT_KEYPASSWD], key_password) 230: end
Set SSL Key type “ The string should be the format of your private key. Supported formats are “PEM”, “DER” and “ENG”. “
# File lib/typhoeus/easy.rb, line 223 223: def ssl_key_type=(key_type) 224: raise "Invalid ssl key type : '#{key_type}'..." if key_type and !%(PEM DER ENG).include?(key_type) 225: set_option(OPTION_VALUES[:CURLOPT_SSLKEYTYPE], key_type) 226: end
gets called when finished and response code is 200-299
# File lib/typhoeus/easy.rb, line 274 274: def success 275: @success.call(self) if @success 276: end
# File lib/typhoeus/easy.rb, line 126 126: def supports_zlib? 127: !!(curl_version.match(/zlib/)) 128: end
# File lib/typhoeus/easy.rb, line 122 122: def timed_out? 123: @timeout && total_time_taken > @timeout && response_code == 0 124: end
# File lib/typhoeus/easy.rb, line 116 116: def timeout=(milliseconds) 117: @timeout = milliseconds 118: set_option(OPTION_VALUES[:CURLOPT_NOSIGNAL], 1) 119: set_option(OPTION_VALUES[:CURLOPT_TIMEOUT_MS], milliseconds) 120: end
# File lib/typhoeus/easy.rb, line 86 86: def total_time_taken 87: get_info_double(INFO_VALUES[:CURLINFO_TOTAL_TIME]) 88: end
# File lib/typhoeus/easy.rb, line 145 145: def url=(url) 146: @url = url 147: set_option(OPTION_VALUES[:CURLOPT_URL], url) 148: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.