module Proxied::Shared::ClassMethods

Public Instance Methods

format_proxy_address(host, port = 80, include_protocol = false) click to toggle source

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

# File lib/proxied/shared.rb, line 16
def format_proxy_address(host, port = 80, include_protocol = false)
  ::Proxied::Utilities.format_proxy_address(host: host, port: port, include_protocol: include_protocol)
end
format_proxy_credentials(username, password) click to toggle source
# File lib/proxied/shared.rb, line 20
def format_proxy_credentials(username, password)
  ::Proxied::Utilities.format_proxy_credentials(username, password)
end
get_proxies(protocol: :all, proxy_type: :all, category: nil, country: nil) click to toggle source
# File lib/proxied/shared.rb, line 5
def get_proxies(protocol: :all, proxy_type: :all, category: nil, country: 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?
  proxies     =   proxies.where(country: country.to_s.upcase) unless country.to_s.empty?

  return proxies
end