Class: Proxybonanza::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/proxybonanza/client.rb

Constant Summary collapse

BASE_URL =
"https://api.proxybonanza.com/v1/".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/proxybonanza/client.rb', line 9

def initialize(api_key)
  @api_key = api_key
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



8
9
10
# File 'lib/proxybonanza/client.rb', line 8

def api_key
  @api_key
end

Instance Method Details

#delete_authip(authip_id) ⇒ Object

DELETE api.proxybonanza.com/v1/authips/[auth IP ID].json Remove authentication IP from proxy plan. Substitute [auth IP ID] with ID from GET api.proxybonanza.com/v1/authips.json results.



40
41
42
# File 'lib/proxybonanza/client.rb', line 40

def delete_authip(authip_id)
  Responses::DeleteAuthip.new delete("authips/#{authip_id}.json")
end

#get_authipsObject

GET api.proxybonanza.com/v1/authips.json List of all authentication IPs in user account.



28
29
30
# File 'lib/proxybonanza/client.rb', line 28

def get_authips
  Responses::GetAuthips.new get("authips.json")
end

#get_userpackage(userpackage_id) ⇒ Object

GET api.proxybonanza.com/v1/userpackages/[userpackage ID].json Details of proxy plan including list of proxy IPs. Substitute [userpackage ID] with ID from api.proxybonanza.com/v1/userpackages.json results.



22
23
24
# File 'lib/proxybonanza/client.rb', line 22

def get_userpackage(userpackage_id)
  Responses::GetUserPackage.new get("userpackages/#{userpackage_id}.json")
end

#get_userpackagedailystats(userpackage_id) ⇒ Object

GET api.proxybonanza.com/v1/userpackagedailystats/[userpackage ID].json Data transfer usage stats for the last 30 days. Substitute [userpackage ID] with ID from api.proxybonanza.com/v1/userpackages.json results. bnd_http and bnd_socks show data transfer for socks5 and http proxy protocols in bytes. conn_http and conn_socks show number of requests/connections.



49
50
51
# File 'lib/proxybonanza/client.rb', line 49

def get_userpackagedailystats(userpackage_id)
  Responses::GetUserPackageDailyStats.new get("userpackagedailystats/#{userpackage_id}.json")
end

#get_userpackagehourlystats(userpackage_id) ⇒ Object

GET api.proxybonanza.com/v1/userpackagehourlystats/[userpackage ID].json Data transfer for the last 24 hours. Substitute [userpackage ID] with ID from api.proxybonanza.com/v1/userpackages.json results. When used with date parameter, it’ll show hourly data transfer usage for a given date. For example: api.proxybonanza.com/v1/userpackagehourlystats/[userpackage ID].json?date=2014-01-01.



58
59
60
# File 'lib/proxybonanza/client.rb', line 58

def get_userpackagehourlystats(userpackage_id)
  Responses::GetUserPackageHourlyStats.new get("userpackagehourlystats/#{userpackage_id}.json")
end

#get_userpackagesObject

GET api.proxybonanza.com/v1/userpackages.json List of active proxy plans in user account.



15
16
17
# File 'lib/proxybonanza/client.rb', line 15

def get_userpackages
  Responses::GetUserPackages.new get("userpackages.json")
end

#post_authipsObject

POST api.proxybonanza.com/v1/authips.json Add new authentication IP to proxy plan. POST parameters: ip, userpackage_id. Returns ID of created authentication IP.



34
35
36
# File 'lib/proxybonanza/client.rb', line 34

def post_authips
  Responses::PostAuthips.new post("authips.json")
end