Module: Proxied::Shared::ClassMethods

Defined in:
lib/proxied/shared.rb

Instance Method Summary collapse

Instance Method Details

#format_proxy_address(host, port = 80, include_http = false) ⇒ Object

Keep these for compatibility for now, they just wrap the utility functions



15
16
17
# File 'lib/proxied/shared.rb', line 15

def format_proxy_address(host, port = 80, include_http = false)
  ::Proxied::Utilities.format_proxy_address(host: host, port: port, include_http: include_http)
end

#format_proxy_credentials(username, password) ⇒ Object



19
20
21
# File 'lib/proxied/shared.rb', line 19

def format_proxy_credentials(username, password)
  ::Proxied::Utilities.format_proxy_credentials(username, password)
end

#get_proxies(protocol: :all, proxy_type: :all, category: nil) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/proxied/shared.rb', line 5

def get_proxies(protocol: :all, proxy_type: :all, category: nil)
  proxies     =   ::Proxy.where(nil)
  proxies     =   proxies.where(protocol: protocol)     if (protocol && !protocol.downcase.to_sym.eql?(:all))
  proxies     =   proxies.where(proxy_type: proxy_type) if (proxy_type && !proxy_type.downcase.to_sym.eql?(:all))
  proxies     =   proxies.where(category: category) unless category.to_s.empty?

  return proxies
end