Class: HttpProxyPool::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/http_proxy_pool/proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Proxy

Returns a new instance of Proxy.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/http_proxy_pool/proxy.rb', line 19

def initialize(args = {})
  @ip         = args[:ip]
  @port       = args[:port]
  @username   = args[:username] || ''
  @password   = args[:password] || ''
  @proxy_type = args[:proxy_type]
  @proxy_level= args[:proxy_level]
  @speed      = args[:speed]
  @added_time = args[:added_time]
  @last_access= args[:last_access]
  @nation     = args[:nation]
  @province   = args[:province]
  @src_from   = args[:src_from]
  @try_times  = args[:try_times] || 0
end

Instance Attribute Details

#added_timeObject

Returns the value of attribute added_time.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def added_time
  @added_time
end

#ipObject

Returns the value of attribute ip.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def ip
  @ip
end

#last_access_timeObject

Returns the value of attribute last_access_time.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def last_access_time
  @last_access_time
end

#nationObject

Returns the value of attribute nation.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def nation
  @nation
end

#passwordObject

Returns the value of attribute password.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def password
  @password
end

#portObject

Returns the value of attribute port.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def port
  @port
end

#provinceObject

Returns the value of attribute province.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def province
  @province
end

#proxy_levelObject

Returns the value of attribute proxy_level.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def proxy_level
  @proxy_level
end

#proxy_typeObject

Returns the value of attribute proxy_type.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def proxy_type
  @proxy_type
end

#speedObject

Returns the value of attribute speed.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def speed
  @speed
end

#src_fromObject

Returns the value of attribute src_from.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def src_from
  @src_from
end

#try_timesObject

Returns the value of attribute try_times.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def try_times
  @try_times
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/http_proxy_pool/proxy.rb', line 5

def username
  @username
end

Instance Method Details

#to_arrObject



35
36
37
# File 'lib/http_proxy_pool/proxy.rb', line 35

def to_arr
  [@ip, @port, @proxy_type, @proxy_level, @nation, @province]
end

#to_sObject



39
40
41
# File 'lib/http_proxy_pool/proxy.rb', line 39

def to_s
  "#{@ip}\t#{@port}"
end