Module: Luminati::Client::Zone
- Included in:
- Luminati::Client
- Defined in:
- lib/luminati/client/zone.rb,
lib/luminati/client/zone/ips.rb
Defined Under Namespace
Modules: Ips
Instance Method Summary collapse
-
#active_zones ⇒ Object
Returns active zones.
-
#add_zone(zone_info, plan_info) ⇒ String
Adds a zone.
-
#remove_zone(zone_name) ⇒ String
Remove a zone.
-
#zone_available_ip_count(zone_name, plan = nil) ⇒ Hash
Returns the number of available IPs.
-
#zone_available_ips(zone_name, country_code = nil, expand = false) ⇒ Hash
Returns avaialble IPs in a given zone and a given country.
-
#zone_available_vips(zone_name) ⇒ Hash
Returns available VIPs in a given zone.
-
#zone_bandwidth_stats(zone_name, from = nil, to = nil) ⇒ Hash
Returns the bandwidth stats for a given zone.
-
#zone_cost_stats(zone_name, from = nil, to = nil) ⇒ Hash
Returns the cost and the bandwidth stats for a given zone.
-
#zone_info(zone_name) ⇒ Hash
Returns the information of a given zone.
-
#zone_passwords(zone_name) ⇒ Object
Returns passwords of a given zone.
-
#zone_permissions(zone_name) ⇒ Object
Returns permissions of a given zone.
-
#zone_recent_ips(zone_names) ⇒ Hash
Returns recent IPs attempting to use a given zone.
-
#zone_status(zone_name) ⇒ Object
Returns the status of a given zone.
Instance Method Details
#active_zones ⇒ Object
Returns active zones
135 136 137 |
# File 'lib/luminati/client/zone.rb', line 135 def active_zones request(:get, "/api/zone/get_active_zones") end |
#add_zone(zone_info, plan_info) ⇒ String
Adds a zone
88 89 90 91 92 93 |
# File 'lib/luminati/client/zone.rb', line 88 def add_zone(zone_info, plan_info) data = {} data["zone"] = zone_info unless zone_info.empty? data["plan"] = plan_info unless plan_info.empty? request(:post, "/api/zone", Oj.dump(data, mode: :compat)) end |
#remove_zone(zone_name) ⇒ String
Remove a zone
99 100 101 102 103 |
# File 'lib/luminati/client/zone.rb', line 99 def remove_zone(zone_name) data = {} data["zone"] = zone_name request(:delete, "/api/zone", Oj.dump(data, mode: :compat)) end |
#zone_available_ip_count(zone_name, plan = nil) ⇒ Hash
Returns the number of available IPs
37 38 39 40 41 |
# File 'lib/luminati/client/zone.rb', line 37 def zone_available_ip_count(zone_name, plan = nil) parameters = "zone=#{zone_name}" parameters << "&plan=#{Oj.dump(plan, mode: :compat)}" if plan request(:get, "/api/zone/count_available_ips?#{parameters}") end |
#zone_available_ips(zone_name, country_code = nil, expand = false) ⇒ Hash
Returns avaialble IPs in a given zone and a given country
58 59 60 61 62 63 |
# File 'lib/luminati/client/zone.rb', line 58 def zone_available_ips(zone_name, country_code = nil, = false) parameters = "zone=#{zone_name}" parameters << "&country=#{country_code}" if country_code parameters << "&expand=1" if request(:get, "/api/zone/route_ips?#{parameters}") end |
#zone_available_vips(zone_name) ⇒ Hash
Returns available VIPs in a given zone
69 70 71 72 |
# File 'lib/luminati/client/zone.rb', line 69 def zone_available_vips(zone_name) parameters = "zone=#{zone_name}" request(:get, "/api/zone/route_vips?#{parameters}") end |
#zone_bandwidth_stats(zone_name, from = nil, to = nil) ⇒ Hash
Returns the bandwidth stats for a given zone
12 13 14 15 16 17 |
# File 'lib/luminati/client/zone.rb', line 12 def zone_bandwidth_stats(zone_name, from = nil, to = nil) parameters = "zone=#{zone_name}&details=1" parameters << "&from=#{from}" if from parameters << "&to=#{to}" if to request(:get, "/api/zone/bw?#{parameters}") end |
#zone_cost_stats(zone_name, from = nil, to = nil) ⇒ Hash
Returns the cost and the bandwidth stats for a given zone
25 26 27 28 29 30 |
# File 'lib/luminati/client/zone.rb', line 25 def zone_cost_stats(zone_name, from = nil, to = nil) parameters = "zone=#{zone_name}" parameters << "&from=#{from}" if from parameters << "&to=#{to}" if to request(:get, "/api/zone/cost?#{parameters}") end |
#zone_info(zone_name) ⇒ Hash
Returns the information of a given zone
78 79 80 81 |
# File 'lib/luminati/client/zone.rb', line 78 def zone_info(zone_name) parameters = "zone=#{zone_name}" request(:get, "/api/zone?#{parameters}") end |
#zone_passwords(zone_name) ⇒ Object
Returns passwords of a given zone
109 110 111 112 |
# File 'lib/luminati/client/zone.rb', line 109 def zone_passwords(zone_name) parameters = "zone=#{zone_name}" request(:get, "/api/zone/passwords?#{parameters}") end |
#zone_permissions(zone_name) ⇒ Object
Returns permissions of a given zone
118 119 120 121 |
# File 'lib/luminati/client/zone.rb', line 118 def (zone_name) parameters = "zone=#{zone_name}" request(:get, "/api/zone/permissions?#{parameters}") end |
#zone_recent_ips(zone_names) ⇒ Hash
Returns recent IPs attempting to use a given zone
47 48 49 50 |
# File 'lib/luminati/client/zone.rb', line 47 def zone_recent_ips(zone_names) parameters = "zones=#{zone_names}" request(:get, "/api/zone/recent_ips?#{parameters}") end |
#zone_status(zone_name) ⇒ Object
Returns the status of a given zone
127 128 129 130 |
# File 'lib/luminati/client/zone.rb', line 127 def zone_status(zone_name) parameters = "zone=#{zone_name}" request(:get, "/api/zone/status?#{parameters}") end |