hetzner-api 1.0.0.alpha.3 → 1.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hetzner-api (1.0.0.alpha.2)
4
+ hetzner-api (1.0.0.alpha.3)
5
5
  httparty
6
6
  thor
7
7
 
data/README.rdoc CHANGED
@@ -12,6 +12,8 @@ see http://wiki.hetzner.de/index.php?title=Robot_Webservice_en for details.
12
12
 
13
13
  == Example
14
14
 
15
+ <b>See spec/hetzner_api_spec.rb[link:spec/hetzner_api_spec.rb] for nice examples!</b>
16
+
15
17
  <tt>h = Hetzner::API.new "username", "password"</tt>
16
18
 
17
19
  <tt>h.reset? "111.111.111.111"</tt>
@@ -24,6 +26,76 @@ see http://wiki.hetzner.de/index.php?title=Robot_Webservice_en for details.
24
26
 
25
27
  <tt>h.rdns! "111.111.111.222", "web100.falkenstein.de.example.com"</tt>
26
28
 
29
+ == Coverage
30
+
31
+ Reset
32
+ query
33
+ should list available reset options for all servers
34
+ should list available reset options for a specific IP
35
+ should fail when IP is unknown
36
+ should fail when IP has no reset option
37
+ execution
38
+ should reset the specific IP
39
+ should fail for the specific IP if input is invalid
40
+ should fail for the specific IP if a manual reset is active
41
+ should fail for the specific IP if reset is unavailable
42
+ should fail for the specific IP if IP is unknown
43
+
44
+ Boot
45
+ query boot configuration
46
+ should display the boot configuration
47
+ the rescue system
48
+ should be able to activate
49
+ should be able to deactivate
50
+
51
+ Rdns
52
+ should query the current rdns status
53
+ should be able to set a new ptr
54
+ should be able to remove a new ptr
55
+
56
+ VNC
57
+ should be able to query vnc boot status
58
+ should be able to set vnc boot status
59
+ should be able to disable vnc boot status
60
+
61
+ WOL
62
+ should be able to query WOL status
63
+ should be able to send a WOL notification
64
+
65
+ IP
66
+ information
67
+ should be able to display all IP addresses of the customer account
68
+ should be able to display a IP address of the customer account
69
+ should be able to display all IP addresses for a given server IP address
70
+ manage traffic warnings
71
+ should be able to activate and set traffic warning limits on a specific IP address
72
+ should be able to deactivate traffic warnings for a specific IP address
73
+
74
+ Subnet
75
+ information
76
+ should be able to display all IP subnets of the customer account
77
+ should be able to display a IP subnet of the customer account
78
+ should be able to display all IP addresses for a given server IP address
79
+ manage traffic warnings
80
+ should be able to activate and set traffic warning limits on a specific IP address
81
+ should be able to deactivate traffic warnings for a specific IP address
82
+
83
+ Server
84
+ information
85
+ should be able to display all servers of the customer account
86
+ should be able to display a specific server by its IP address
87
+
88
+ Plesk
89
+ should be able to query plesk boot option status
90
+ should be able to activate plesk boot option
91
+ should be able to disable plesk boot option
92
+
93
+ Traffic
94
+ should display the traffic for a specific ip address and a subnet
95
+ should display the traffic for serveral IP addresse and no subnet
96
+ should display the traffic for subnets and no ip address
97
+
98
+
27
99
  == Readme (rdoc)
28
100
 
29
101
  <b>http://rdoc.info/github/rmoriz/hetzner-api</b>
@@ -1,5 +1,5 @@
1
1
  module Hetzner
2
2
  class API
3
- VERSION = "1.0.0.alpha.3"
3
+ VERSION = "1.0.0.beta.1"
4
4
  end
5
5
  end
@@ -24,42 +24,42 @@ describe "Reset" do
24
24
  result.response.should be_an_instance_of Net::HTTPNotFound
25
25
  result.parsed_response.should have_JSON_error_code :SERVER_NOT_FOUND
26
26
  end
27
-
27
+
28
28
  it "should fail when IP has no reset option" do
29
29
  result = @h.reset? RESET_IP_NOT_AVAILABLE
30
30
  result.response.should be_an_instance_of Net::HTTPNotFound
31
31
  result.parsed_response.should have_JSON_error_code :RESET_NOT_AVAILABLE
32
- end
32
+ end
33
33
  end
34
34
 
35
35
  describe "execution" do
36
36
  before(:all) do
37
37
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
38
38
  end
39
-
39
+
40
40
  it "should reset the specific IP" do
41
41
  result = @h.reset! WORKING_IP, :sw
42
42
  result.response.should be_an_instance_of Net::HTTPOK
43
43
  end
44
-
44
+
45
45
  it "should fail for the specific IP if input is invalid" do
46
46
  result = @h.reset! WORKING_IP, :foo
47
47
  result.response.should be_an_instance_of Net::HTTPBadRequest
48
48
  result.parsed_response.should have_JSON_error_code :INVALID_INPUT
49
49
  end
50
-
50
+
51
51
  it "should fail for the specific IP if a manual reset is active" do
52
52
  result = @h.reset! RESET_IP_MANUAL_ACTIVE, :sw
53
53
  result.response.should be_an_instance_of Net::HTTPConflict
54
54
  result.parsed_response.should have_JSON_error_code :RESET_MANUAL_ACTIVE
55
55
  end
56
-
56
+
57
57
  it "should fail for the specific IP if reset is unavailable" do
58
58
  result = @h.reset! RESET_IP_NOT_AVAILABLE, :sw
59
59
  result.response.should be_an_instance_of Net::HTTPNotFound
60
60
  result.parsed_response.should have_JSON_error_code :RESET_NOT_AVAILABLE
61
61
  end
62
-
62
+
63
63
  it "should fail for the specific IP if IP is unknown" do
64
64
  result = @h.reset! UNKOWN_IP, :sw
65
65
  result.response.should be_an_instance_of Net::HTTPNotFound
@@ -73,19 +73,18 @@ describe "Boot" do
73
73
  before(:all) do
74
74
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
75
75
  end
76
-
76
+
77
77
  it "should display the boot configuration" do
78
- result = @h.boot? WORKING_IP
78
+ result = @h.boot? WORKING_IP
79
79
  result.response.should be_an_instance_of Net::HTTPOK
80
80
  end
81
81
  end
82
82
 
83
-
84
83
  describe "the rescue system" do
85
84
  before(:all) do
86
85
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
87
86
  end
88
-
87
+
89
88
  it "should be able to activate" do
90
89
  result = @h.enable_rescue! WORKING_IP
91
90
  result.response.should be_an_instance_of Net::HTTPOK
@@ -95,7 +94,7 @@ describe "Boot" do
95
94
  #result['rescue']['os'].should == 'linux'
96
95
  #result['rescue']['active'].should be_true
97
96
  end
98
-
97
+
99
98
  it "should be able to deactivate" do
100
99
  result = @h.disable_rescue! WORKING_IP
101
100
  result.response.should be_an_instance_of Net::HTTPOK
@@ -107,17 +106,17 @@ describe "Rdns" do
107
106
  before(:all) do
108
107
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
109
108
  end
110
-
109
+
111
110
  it "should query the current rdns status" do
112
111
  result = @h.rdns? WORKING_IP
113
112
  result.response.should be_an_instance_of Net::HTTPOK
114
- result['rdns']['ip'].should == WORKING_IP
113
+ result['rdns']['ip'].should == WORKING_IP
115
114
  result['rdns']['ptr'].should == TEST_PTR
116
115
  end
117
-
116
+
118
117
  it "should be able to set a new ptr" do
119
118
  result = @h.rdns! WORKING_IP, TEST_PTR
120
- result.response.should be_an_instance_of Net::HTTPOK
119
+ result.response.should be_an_instance_of Net::HTTPOK
121
120
  result['rdns']['ip'].should == WORKING_IP
122
121
  result['rdns']['ptr'].should == TEST_PTR
123
122
  end
@@ -132,7 +131,7 @@ describe "VNC" do
132
131
  before(:all) do
133
132
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
134
133
  end
135
-
134
+
136
135
  it "should be able to query vnc boot status" do
137
136
  result = @h.boot_vnc? WORKING_IP
138
137
  result.response.should be_an_instance_of Net::HTTPOK
@@ -140,7 +139,7 @@ describe "VNC" do
140
139
  result['vnc']['active'].should be_false
141
140
  result['vnc']['password'].should be_nil
142
141
  end
143
-
142
+
144
143
  it "should be able to set vnc boot status" do
145
144
  result = @h.boot_vnc! WORKING_IP, 'Fedora-13', '32', 'en_US'
146
145
  result.response.should be_an_instance_of Net::HTTPOK
@@ -148,7 +147,7 @@ describe "VNC" do
148
147
  result['vnc']['active'].should be_true
149
148
  result['vnc']['password'].should_not be_nil
150
149
  end
151
-
150
+
152
151
  it "should be able to disable vnc boot status" do
153
152
  result = @h.disable_boot_vnc! WORKING_IP
154
153
  result.response.should be_an_instance_of Net::HTTPOK
@@ -162,13 +161,13 @@ describe "WOL" do
162
161
  before(:all) do
163
162
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
164
163
  end
165
-
164
+
166
165
  it "should be able to query WOL status" do
167
166
  result = @h.wol? WORKING_IP
168
167
  result.response.should be_an_instance_of Net::HTTPOK
169
168
  result['wol']['server_ip'].should == WORKING_IP
170
169
  end
171
-
170
+
172
171
  it "should be able to send a WOL notification" do
173
172
  result = @h.wol! WORKING_IP
174
173
  result.response.should be_an_instance_of Net::HTTPOK
@@ -181,12 +180,13 @@ describe 'IP' do
181
180
  before(:all) do
182
181
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
183
182
  end
183
+
184
184
  it "should be able to display all IP addresses of the customer account" do
185
185
  result = @h.ips?
186
186
  result.response.should be_an_instance_of Net::HTTPOK
187
187
  result.parsed_response.should have_at_least(2).entries
188
- end
189
-
188
+ end
189
+
190
190
  it "should be able to display a IP address of the customer account" do
191
191
  result = @h.ip? WORKING_IP
192
192
  result.response.should be_an_instance_of Net::HTTPOK
@@ -199,7 +199,7 @@ describe 'IP' do
199
199
  result.parsed_response.should have(2).entry
200
200
  end
201
201
  end
202
-
202
+
203
203
  describe "manage traffic warnings" do
204
204
  before(:all) do
205
205
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
@@ -224,36 +224,37 @@ describe 'Subnet' do
224
224
  before(:all) do
225
225
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
226
226
  end
227
+
227
228
  it "should be able to display all IP subnets of the customer account" do
228
229
  result = @h.subnets?
229
230
  result.response.should be_an_instance_of Net::HTTPOK
230
231
  result.parsed_response.should have_at_least(2).entries
231
- end
232
-
232
+ end
233
+
233
234
  it "should be able to display a IP subnet of the customer account" do
234
235
  result = @h.subnet? WORKING_SUBNET_IP
235
236
  result.response.should be_an_instance_of Net::HTTPOK
236
237
  result.parsed_response.should have(1).entry
237
238
  end
238
-
239
+
239
240
  it "should be able to display all IP addresses for a given server IP address" do
240
241
  result = @h.subnets_for_server? WORKING_IP
241
242
  result.response.should be_an_instance_of Net::HTTPOK
242
243
  result.parsed_response.should have(1).entry
243
244
  end
244
245
  end
245
-
246
+
246
247
  describe "manage traffic warnings" do
247
248
  before(:all) do
248
249
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
249
250
  end
250
-
251
+
251
252
  it "should be able to activate and set traffic warning limits on a specific IP address" do
252
253
  result = @h.ip! WORKING_IP, :traffic_warnings => 'true', :traffic_monthly => TRAFFIC_LIMIT_IN_GIGABYTE
253
254
  result.response.should be_an_instance_of Net::HTTPOK
254
255
  result.parsed_response.should have(1).entry
255
256
  end
256
-
257
+
257
258
  it "should be able to deactivate traffic warnings for a specific IP address" do
258
259
  result = @h.ip! WORKING_IP, :traffic_warnings => 'false'
259
260
  result.response.should be_an_instance_of Net::HTTPOK
@@ -262,24 +263,23 @@ describe 'Subnet' do
262
263
  end
263
264
  end
264
265
 
265
-
266
266
  describe "Server" do
267
267
  describe "information" do
268
268
  before(:all) do
269
269
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
270
270
  end
271
-
271
+
272
272
  it "should be able to display all servers of the customer account" do
273
273
  result = @h.servers?
274
274
  result.response.should be_an_instance_of Net::HTTPOK
275
275
  result.parsed_response.should have_at_least(2).entries
276
276
  end
277
-
277
+
278
278
  it "should be able to display a specific server by its IP address" do
279
279
  result = @h.server? WORKING_IP
280
280
  result.response.should be_an_instance_of Net::HTTPOK
281
281
  result.parsed_response.should have_at_least(1).entry
282
- end
282
+ end
283
283
  end
284
284
  end
285
285
 
@@ -287,7 +287,7 @@ describe "Plesk" do
287
287
  before(:all) do
288
288
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
289
289
  end
290
-
290
+
291
291
  it "should be able to query plesk boot option status" do
292
292
  result = @h.boot_plesk? WORKING_IP
293
293
  result.response.should be_an_instance_of Net::HTTPOK
@@ -295,7 +295,7 @@ describe "Plesk" do
295
295
  result['plesk']['active'].should be_false
296
296
  result['plesk']['password'].should be_nil
297
297
  end
298
-
298
+
299
299
  it "should be able to activate plesk boot option" do
300
300
  result = @h.boot_plesk! WORKING_IP, 'Fedora-13', '32', 'en_US', 'dr-gerner-aus-gzsz.confixx.de'
301
301
  result.response.should be_an_instance_of Net::HTTPOK
@@ -303,7 +303,7 @@ describe "Plesk" do
303
303
  result['plesk']['active'].should be_true
304
304
  result['plesk']['password'].should_not be_nil
305
305
  end
306
-
306
+
307
307
  it "should be able to disable plesk boot option" do
308
308
  result = @h.disable_boot_plesk! WORKING_IP
309
309
  result.response.should be_an_instance_of Net::HTTPOK
@@ -317,7 +317,7 @@ describe "Traffic" do
317
317
  before(:all) do
318
318
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
319
319
  end
320
-
320
+
321
321
  it "should display the traffic for a specific ip address and a subnet" do
322
322
  options = {
323
323
  :ips => [WORKING_IP],
@@ -331,7 +331,7 @@ describe "Traffic" do
331
331
 
332
332
  result.response.should be_an_instance_of Net::HTTPOK
333
333
  end
334
-
334
+
335
335
  it "should display the traffic for serveral IP addresse and no subnet" do
336
336
  options = {
337
337
  :ips => [WORKING_IP, WORKING_IP_2],
@@ -344,8 +344,8 @@ describe "Traffic" do
344
344
  result = @h.traffic? options
345
345
 
346
346
  result.response.should be_an_instance_of Net::HTTPOK
347
- end
348
-
347
+ end
348
+
349
349
  it "should display the traffic for subnets and no ip address" do
350
350
  options = {
351
351
  :ips => [],
@@ -358,5 +358,5 @@ describe "Traffic" do
358
358
  result = @h.traffic? options
359
359
 
360
360
  result.response.should be_an_instance_of Net::HTTPOK
361
- end
361
+ end
362
362
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hetzner-api
3
3
  version: !ruby/object:Gem::Version
4
- hash: -3702664326
4
+ hash: 62196353
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
9
  - 0
10
- - alpha
11
- - 3
12
- version: 1.0.0.alpha.3
10
+ - beta
11
+ - 1
12
+ version: 1.0.0.beta.1
13
13
  platform: ruby
14
14
  authors:
15
15
  - Roland Moriz
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-10-09 00:00:00 +02:00
20
+ date: 2010-10-11 00:00:00 +02:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency