ivapi 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ivapi.rb +6 -2
- data/lib/ivapi/client/account.rb +16 -0
- data/lib/ivapi/version.rb +1 -1
- data/spec/fixtures/server_flush_iptables.json +3 -0
- data/spec/ivapi/client/server_spec.rb +18 -0
- data/spec/ivapi_spec.rb +16 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cacbc8c20ae024122a47f3c20acdf895f62bbfc
|
4
|
+
data.tar.gz: e8d15da2d6c239b8f7c6a7ac28c6e436eafd1ddc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca16bee5cd6e80296e26886f22b18182c44705dd249d3fc88c910e9a405bb5e50eb3f4e676843e73a75dd1511f89602f7a35fc866e44dd17ec2ed5c6441f47d0
|
7
|
+
data.tar.gz: 195f2902ce96c8475e62eb295be70b2187f1e3958cd2a1b3369f967d283e337d4ce1fa36def557ed16f2ab7253af7a2b616f7a0a484baa60bf19ed6b973ad0cd
|
data/lib/ivapi.rb
CHANGED
data/lib/ivapi/client/account.rb
CHANGED
@@ -1,26 +1,42 @@
|
|
1
1
|
module Ivapi
|
2
2
|
class Client
|
3
3
|
module Account
|
4
|
+
|
5
|
+
# Get account information.
|
6
|
+
#
|
7
|
+
# Returns the hash of account information.
|
4
8
|
def account_info
|
5
9
|
params = { command: 'account_info' }
|
6
10
|
get('/json.php', params)
|
7
11
|
end
|
8
12
|
|
13
|
+
# Get account orders.
|
14
|
+
#
|
15
|
+
# Returns the hash of account orders.
|
9
16
|
def account_orders
|
10
17
|
params = { command: 'account_orders' }
|
11
18
|
get('/json.php', params)
|
12
19
|
end
|
13
20
|
|
21
|
+
# Get account services.
|
22
|
+
#
|
23
|
+
# Returns the hash of account services.
|
14
24
|
def account_services
|
15
25
|
params = { command: 'account_services' }
|
16
26
|
get('/json.php', params)
|
17
27
|
end
|
18
28
|
|
29
|
+
# Get account credits.
|
30
|
+
#
|
31
|
+
# Returns the hash of account credits.
|
19
32
|
def account_credits(count = 10)
|
20
33
|
options = { command: 'account_credits', count: count }
|
21
34
|
get('/json.php', params)
|
22
35
|
end
|
23
36
|
|
37
|
+
# Get account bonuses.
|
38
|
+
#
|
39
|
+
# Returns the hash of account bonuses.
|
24
40
|
def account_bonuses(count = 10)
|
25
41
|
params = { :command => 'account_bonuses', count: count }
|
26
42
|
get('/json.php', params)
|
data/lib/ivapi/version.rb
CHANGED
@@ -13,6 +13,18 @@ describe Ivapi::Client::Server do
|
|
13
13
|
expect(server_info.se_info.in_node).to eq("Robinija")
|
14
14
|
end
|
15
15
|
|
16
|
+
it "should return server tasks" do
|
17
|
+
stub_command("server_tasks", {id: 3, count: 1}).to_return(json_response("server_tasks.json"))
|
18
|
+
server_tasks = @client.server_tasks(1)
|
19
|
+
expect(server_tasks.first.ta_params.domain).to eq("server.example.com")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return server tasks with specified options" do
|
23
|
+
stub_command("server_tasks", {id: 3, count: 1, task_id: 1}).to_return(json_response("server_tasks.json"))
|
24
|
+
server_tasks = @client.server_tasks(1, {task_id: 1})
|
25
|
+
expect(server_tasks.first.ta_params.domain).to eq("server.example.com")
|
26
|
+
end
|
27
|
+
|
16
28
|
it "should return server graphs" do
|
17
29
|
stub_command("server_graphs", {id: 3, width: 1000, ip: "12.23.34.45"}).to_return(json_response("server_graphs.json"))
|
18
30
|
server_graphs = @client.server_graphs(1000, "12.23.34.45")
|
@@ -43,6 +55,12 @@ describe Ivapi::Client::Server do
|
|
43
55
|
expect(server_reset_password.task_id).to eq("13")
|
44
56
|
end
|
45
57
|
|
58
|
+
it "should flush server iptables" do
|
59
|
+
stub_command("server_flush_iptables", {id: 3}).to_return(json_response("server_flush_iptables.json"))
|
60
|
+
server_flush_iptables = @client.server_flush_iptables
|
61
|
+
expect(server_flush_iptables.task_id).to eq("16")
|
62
|
+
end
|
63
|
+
|
46
64
|
it "should change server plan" do
|
47
65
|
stub_command("server_change", {id: 3}).to_return(json_response("server_change.json"))
|
48
66
|
server_change = @client.server_change
|
data/spec/ivapi_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe Ivapi do
|
3
|
+
|
4
|
+
describe ".respond_to?" do
|
5
|
+
it "is true if method exists" do
|
6
|
+
expect(Ivapi.respond_to?(:new, true)).to eq(true)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".new" do
|
11
|
+
it "is a Ivapi::Client" do
|
12
|
+
expect(Ivapi.new).to be_a Ivapi::Client
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ivapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justas Palumickas
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- spec/fixtures/account_services.json
|
129
129
|
- spec/fixtures/server_change.json
|
130
130
|
- spec/fixtures/server_domain.json
|
131
|
+
- spec/fixtures/server_flush_iptables.json
|
131
132
|
- spec/fixtures/server_graphs.json
|
132
133
|
- spec/fixtures/server_info.json
|
133
134
|
- spec/fixtures/server_os.json
|
@@ -139,6 +140,7 @@ files:
|
|
139
140
|
- spec/ivapi/client/account_spec.rb
|
140
141
|
- spec/ivapi/client/server_spec.rb
|
141
142
|
- spec/ivapi/client_spec.rb
|
143
|
+
- spec/ivapi_spec.rb
|
142
144
|
- spec/spec_helper.rb
|
143
145
|
homepage: https://github.com/jpalumickas/ivapi/
|
144
146
|
licenses:
|
@@ -171,6 +173,7 @@ test_files:
|
|
171
173
|
- spec/fixtures/account_services.json
|
172
174
|
- spec/fixtures/server_change.json
|
173
175
|
- spec/fixtures/server_domain.json
|
176
|
+
- spec/fixtures/server_flush_iptables.json
|
174
177
|
- spec/fixtures/server_graphs.json
|
175
178
|
- spec/fixtures/server_info.json
|
176
179
|
- spec/fixtures/server_os.json
|
@@ -182,4 +185,5 @@ test_files:
|
|
182
185
|
- spec/ivapi/client/account_spec.rb
|
183
186
|
- spec/ivapi/client/server_spec.rb
|
184
187
|
- spec/ivapi/client_spec.rb
|
188
|
+
- spec/ivapi_spec.rb
|
185
189
|
- spec/spec_helper.rb
|