Class: HttpCrawler::Web::Httpbin::Client

Inherits:
Client show all
Defined in:
lib/http_crawler/web/httpbin/client.rb

Instance Attribute Summary

Attributes inherited from Client

#all_timeout, #connect_time, #cookies, #error_urls, #header, #max_error_num, #read_time, #redirect, #response, #uri, #write_time

Instance Method Summary collapse

Methods inherited from Client

#add_error_url, #auto_proxy=, for, for_module, for_uri, #get, #get_proxy, #get_uri, #http, #inheritance_cookies, #init_cookies, #init_header, #init_ssl, #init_timeout, #initialize, #post, #proxy_api, #proxy_params, #remove_traces, #replace_header, #update_cookies, #update_header, #update_proxy, #update_proxy?, #update_uri, #validation_to_proxy?

Constructor Details

This class inherits a constructor from HttpCrawler::Client

Instance Method Details

#init_clientObject



7
8
9
10
# File 'lib/http_crawler/web/httpbin/client.rb', line 7

def init_client
  # 设置整体超时时间 3 秒
  @all_timeout = 3
end

#init_uriObject



12
13
14
# File 'lib/http_crawler/web/httpbin/client.rb', line 12

def init_uri
  @uri = URI("http://httpbin.org/")
end

#ip(parameter = {}) ⇒ Object



16
17
18
19
# File 'lib/http_crawler/web/httpbin/client.rb', line 16

def ip(parameter = {})
  r = get("ip")
  r.extend(HttpCrawler::Web::Httpbin::Response::Ip)
end