Class: Clients::Proxy6Client
- Inherits:
-
Object
- Object
- Clients::Proxy6Client
- Defined in:
- lib/clients/proxy6_client.rb
Constant Summary collapse
- API_URL =
"https://proxy6.net/api".freeze
Instance Attribute Summary collapse
-
#ip_version ⇒ Object
readonly
Returns the value of attribute ip_version.
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(api_url: API_URL, api_key: ENV["PROXY6_KEY"], ip_version: "4") ⇒ Proxy6Client
constructor
A new instance of Proxy6Client.
- #password ⇒ Object
- #port ⇒ Object
- #reset! ⇒ Object
- #to_s ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(api_url: API_URL, api_key: ENV["PROXY6_KEY"], ip_version: "4") ⇒ Proxy6Client
Returns a new instance of Proxy6Client.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/clients/proxy6_client.rb', line 10 def initialize( api_url: API_URL, api_key: ENV["PROXY6_KEY"], ip_version: "4" ) @api_url = api_url @api_key = api_key @ip_version = ip_version.to_s @proxy = fetch_proxy end |
Instance Attribute Details
#ip_version ⇒ Object (readonly)
Returns the value of attribute ip_version.
8 9 10 |
# File 'lib/clients/proxy6_client.rb', line 8 def ip_version @ip_version end |
Instance Method Details
#host ⇒ Object
21 22 23 |
# File 'lib/clients/proxy6_client.rb', line 21 def host @proxy["host"] end |
#password ⇒ Object
33 34 35 |
# File 'lib/clients/proxy6_client.rb', line 33 def password @proxy["pass"] end |
#port ⇒ Object
25 26 27 |
# File 'lib/clients/proxy6_client.rb', line 25 def port @proxy["port"].to_i end |
#reset! ⇒ Object
41 42 43 |
# File 'lib/clients/proxy6_client.rb', line 41 def reset! @proxy = fetch_proxy end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/clients/proxy6_client.rb', line 37 def to_s [host, port, user, password].compact.join(":") end |
#user ⇒ Object
29 30 31 |
# File 'lib/clients/proxy6_client.rb', line 29 def user @proxy["user"] end |