hetzner-api 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +40 -44
- data/README.rdoc +13 -15
- data/hetzner-api.gemspec +5 -5
- data/lib/hetzner/api/server.rb +10 -4
- data/lib/hetzner/api/version.rb +1 -1
- data/spec/api_stubs.rb +2 -0
- data/spec/fixtures/server/post_with_server_name.raw +24 -0
- data/spec/hetzner_api_spec.rb +11 -4
- metadata +21 -19
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
hetzner-api (1.0.
|
|
5
|
-
httparty
|
|
4
|
+
hetzner-api (1.0.1)
|
|
5
|
+
httparty (>= 0.7.4)
|
|
6
6
|
json
|
|
7
7
|
thor
|
|
8
8
|
xml-simple
|
|
@@ -10,60 +10,56 @@ PATH
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: http://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
-
aruba (0.
|
|
14
|
-
|
|
15
|
-
cucumber (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
background_process (1.2)
|
|
22
|
-
builder (2.1.2)
|
|
13
|
+
aruba (0.3.6)
|
|
14
|
+
childprocess (>= 0.1.7)
|
|
15
|
+
cucumber (>= 0.10.0)
|
|
16
|
+
rspec (>= 2.5.0)
|
|
17
|
+
background_process (1.3)
|
|
18
|
+
builder (3.0.0)
|
|
19
|
+
childprocess (0.1.9)
|
|
20
|
+
ffi (~> 1.0.6)
|
|
23
21
|
crack (0.1.8)
|
|
24
|
-
cucumber (0.
|
|
25
|
-
builder (
|
|
26
|
-
diff-lcs (
|
|
27
|
-
gherkin (
|
|
28
|
-
json (
|
|
29
|
-
term-ansicolor (
|
|
22
|
+
cucumber (0.10.3)
|
|
23
|
+
builder (>= 2.1.2)
|
|
24
|
+
diff-lcs (>= 1.1.2)
|
|
25
|
+
gherkin (>= 2.3.8)
|
|
26
|
+
json (>= 1.4.6)
|
|
27
|
+
term-ansicolor (>= 1.0.5)
|
|
30
28
|
diff-lcs (1.1.2)
|
|
31
29
|
fakeweb (1.3.0)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
ffi (1.0.9)
|
|
31
|
+
gherkin (2.3.10)
|
|
32
|
+
json (>= 1.4.6)
|
|
33
|
+
growl (1.0.3)
|
|
34
|
+
guard (0.3.4)
|
|
35
|
+
thor (~> 0.14.6)
|
|
36
|
+
guard-rspec (0.3.1)
|
|
37
|
+
guard (>= 0.2.2)
|
|
38
|
+
httparty (0.7.7)
|
|
36
39
|
crack (= 0.1.8)
|
|
37
|
-
json (1.
|
|
38
|
-
rspec (2.
|
|
39
|
-
rspec-core (
|
|
40
|
-
rspec-expectations (
|
|
41
|
-
rspec-mocks (
|
|
42
|
-
rspec-core (2.
|
|
43
|
-
rspec-expectations (2.
|
|
44
|
-
diff-lcs (
|
|
45
|
-
rspec-mocks (2.
|
|
46
|
-
rspec-core (= 2.0.0)
|
|
47
|
-
rspec-expectations (= 2.0.0)
|
|
48
|
-
sys-uname (0.8.4)
|
|
40
|
+
json (1.5.1)
|
|
41
|
+
rspec (2.6.0)
|
|
42
|
+
rspec-core (~> 2.6.0)
|
|
43
|
+
rspec-expectations (~> 2.6.0)
|
|
44
|
+
rspec-mocks (~> 2.6.0)
|
|
45
|
+
rspec-core (2.6.3)
|
|
46
|
+
rspec-expectations (2.6.0)
|
|
47
|
+
diff-lcs (~> 1.1.2)
|
|
48
|
+
rspec-mocks (2.6.0)
|
|
49
49
|
term-ansicolor (1.0.5)
|
|
50
|
-
thor (0.14.
|
|
51
|
-
xml-simple (1.0.
|
|
50
|
+
thor (0.14.6)
|
|
51
|
+
xml-simple (1.0.16)
|
|
52
52
|
|
|
53
53
|
PLATFORMS
|
|
54
54
|
ruby
|
|
55
55
|
|
|
56
56
|
DEPENDENCIES
|
|
57
57
|
aruba
|
|
58
|
-
|
|
59
|
-
autotest-fsevent
|
|
60
|
-
autotest-growl
|
|
58
|
+
background_process (>= 1.2)
|
|
61
59
|
bundler (>= 1.0.2)
|
|
62
60
|
cucumber
|
|
63
61
|
fakeweb
|
|
62
|
+
growl
|
|
63
|
+
guard-rspec (>= 0.3.1)
|
|
64
64
|
hetzner-api!
|
|
65
|
-
|
|
66
|
-
json
|
|
67
|
-
rspec (>= 2.0.0)
|
|
68
|
-
thor
|
|
69
|
-
xml-simple
|
|
65
|
+
rspec (>= 2.6.0)
|
data/README.rdoc
CHANGED
|
@@ -40,28 +40,28 @@ see http://wiki.hetzner.de/index.php?title=Robot_Webservice_en for details.
|
|
|
40
40
|
should fail for the specific IP if a manual reset is active
|
|
41
41
|
should fail for the specific IP if reset is unavailable
|
|
42
42
|
should fail for the specific IP if IP is unknown
|
|
43
|
-
|
|
43
|
+
|
|
44
44
|
Boot
|
|
45
45
|
query boot configuration
|
|
46
46
|
should display the boot configuration
|
|
47
47
|
the rescue system
|
|
48
48
|
should be able to activate
|
|
49
49
|
should be able to deactivate
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
Rdns
|
|
52
52
|
should query the current rdns status
|
|
53
53
|
should be able to set a new ptr
|
|
54
54
|
should be able to remove a new ptr
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
VNC
|
|
57
57
|
should be able to query vnc boot status
|
|
58
58
|
should be able to set vnc boot status
|
|
59
59
|
should be able to disable vnc boot status
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
WOL
|
|
62
62
|
should be able to query WOL status
|
|
63
63
|
should be able to send a WOL notification
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
IP
|
|
66
66
|
information
|
|
67
67
|
should be able to display all IP addresses of the customer account
|
|
@@ -70,7 +70,7 @@ see http://wiki.hetzner.de/index.php?title=Robot_Webservice_en for details.
|
|
|
70
70
|
manage traffic warnings
|
|
71
71
|
should be able to activate and set traffic warning limits on a specific IP address
|
|
72
72
|
should be able to deactivate traffic warnings for a specific IP address
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
Subnet
|
|
75
75
|
information
|
|
76
76
|
should be able to display all IP subnets of the customer account
|
|
@@ -79,28 +79,28 @@ see http://wiki.hetzner.de/index.php?title=Robot_Webservice_en for details.
|
|
|
79
79
|
manage traffic warnings
|
|
80
80
|
should be able to activate and set traffic warning limits on a specific IP address
|
|
81
81
|
should be able to deactivate traffic warnings for a specific IP address
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
Server
|
|
84
|
+
should be able to set a server_name
|
|
84
85
|
information
|
|
85
86
|
should be able to display all servers of the customer account
|
|
86
87
|
should be able to display a specific server by its IP address
|
|
87
|
-
|
|
88
|
+
|
|
88
89
|
Plesk
|
|
89
90
|
should be able to query plesk boot option status
|
|
90
91
|
should be able to activate plesk boot option
|
|
91
92
|
should be able to disable plesk boot option
|
|
92
|
-
|
|
93
|
+
|
|
93
94
|
Failover
|
|
94
95
|
should be able to query the status of all failover IPs
|
|
95
96
|
should be able to query the status of a single failover IP
|
|
96
97
|
should be able to set the status of a single failover IP
|
|
97
|
-
|
|
98
|
+
|
|
98
99
|
Traffic
|
|
99
100
|
should display the traffic for a specific ip address and a subnet
|
|
100
101
|
should display the traffic for serveral IP addresse and no subnet
|
|
101
102
|
should display the traffic for subnets and no ip address
|
|
102
|
-
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
|
|
105
105
|
== Readme (rdoc)
|
|
106
106
|
|
|
@@ -117,8 +117,6 @@ The gem and the author are not related to Hetzner AG!
|
|
|
117
117
|
|
|
118
118
|
== Copyright
|
|
119
119
|
|
|
120
|
-
Copyright (c)
|
|
120
|
+
Copyright (c) 2011 Roland Moriz. See LICENSE for details.
|
|
121
121
|
|
|
122
122
|
{Ruby on Rails Entwicklung}[http://moriz.de/] -> Moriz GmbH
|
|
123
|
-
|
|
124
|
-
{Ruby on Rails Hosting}[http://rails.io/] -> Rails.io
|
data/hetzner-api.gemspec
CHANGED
|
@@ -19,11 +19,11 @@ Gem::Specification.new do |s|
|
|
|
19
19
|
s.add_dependency 'json'
|
|
20
20
|
s.add_dependency 'xml-simple'
|
|
21
21
|
|
|
22
|
-
s.add_development_dependency "bundler",
|
|
23
|
-
s.add_development_dependency "
|
|
24
|
-
s.add_development_dependency "
|
|
25
|
-
s.add_development_dependency "
|
|
26
|
-
s.add_development_dependency "
|
|
22
|
+
s.add_development_dependency "bundler", ">= 1.0.2"
|
|
23
|
+
s.add_development_dependency "rspec", ">= 2.6.0"
|
|
24
|
+
s.add_development_dependency "guard-rspec", ">= 0.3.1"
|
|
25
|
+
s.add_development_dependency "growl"
|
|
26
|
+
s.add_development_dependency "background_process", ">= 1.2"
|
|
27
27
|
s.add_development_dependency "fakeweb"
|
|
28
28
|
s.add_development_dependency "cucumber"
|
|
29
29
|
s.add_development_dependency "aruba"
|
data/lib/hetzner/api/server.rb
CHANGED
|
@@ -5,15 +5,21 @@ module Hetzner
|
|
|
5
5
|
def servers?
|
|
6
6
|
get_server_or_servers
|
|
7
7
|
end
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
# returns a list of all servers or just for a specific server ip
|
|
10
10
|
def server?(server_ip)
|
|
11
11
|
get_server_or_servers server_ip
|
|
12
12
|
end
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
# update server settings (e.g. server_name)
|
|
15
|
+
def server!(server_ip, args = {})
|
|
16
|
+
path = "/server/#{server_ip}"
|
|
17
|
+
perform_post path, :query => args
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
private
|
|
15
|
-
|
|
16
|
-
def
|
|
21
|
+
|
|
22
|
+
def get_server_or_servers(server_ip = nil)
|
|
17
23
|
path = "/server"
|
|
18
24
|
path << "/#{server_ip}" if server_ip
|
|
19
25
|
perform_get path
|
data/lib/hetzner/api/version.rb
CHANGED
data/spec/api_stubs.rb
CHANGED
|
@@ -143,6 +143,8 @@ FakeWeb.register_uri :get, uri,
|
|
|
143
143
|
FakeWeb.register_uri :get, uri("#{WORKING_IP}"),
|
|
144
144
|
:response => fixture('get_with_server_ip.raw')
|
|
145
145
|
|
|
146
|
+
FakeWeb.register_uri :post, uri("#{WORKING_IP}?server_name=krautchan100"),
|
|
147
|
+
:response => fixture('post_with_server_name.raw')
|
|
146
148
|
|
|
147
149
|
@resource = 'traffic'
|
|
148
150
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
HTTP/1.1 200 OK
|
|
2
|
+
Content-Type: application/json
|
|
3
|
+
|
|
4
|
+
{
|
|
5
|
+
"server": {
|
|
6
|
+
"server_ip": "11.11.11.111",
|
|
7
|
+
"server_name": "krautchan100",
|
|
8
|
+
"product": "EQ 8",
|
|
9
|
+
"dc": 11,
|
|
10
|
+
"traffic": "5 TB",
|
|
11
|
+
"status": "ready",
|
|
12
|
+
"throttled": false,
|
|
13
|
+
"cancelled": false,
|
|
14
|
+
"paid_until": "2010-08-04",
|
|
15
|
+
"ip": ["11.11.11.111"],
|
|
16
|
+
"subnet": [{"ip": "2a01:4f8:111:4221::", "mask": "64"}],
|
|
17
|
+
"reset": true,
|
|
18
|
+
"rescue": true,
|
|
19
|
+
"vnc": true,
|
|
20
|
+
"windows": true,
|
|
21
|
+
"plesk": true,
|
|
22
|
+
"wol": true
|
|
23
|
+
}
|
|
24
|
+
}
|
data/spec/hetzner_api_spec.rb
CHANGED
|
@@ -264,11 +264,11 @@ describe 'Subnet' do
|
|
|
264
264
|
end
|
|
265
265
|
|
|
266
266
|
describe "Server" do
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
end
|
|
267
|
+
before(:all) do
|
|
268
|
+
@h = Hetzner::API.new API_USERNAME, API_PASSWORD
|
|
269
|
+
end
|
|
271
270
|
|
|
271
|
+
describe "information" do
|
|
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
|
|
@@ -281,6 +281,13 @@ describe "Server" do
|
|
|
281
281
|
result.parsed_response.should have_at_least(1).entry
|
|
282
282
|
end
|
|
283
283
|
end
|
|
284
|
+
|
|
285
|
+
it "should be able to set a server_name" do
|
|
286
|
+
result = @h.server! WORKING_IP, :server_name => 'krautchan100'
|
|
287
|
+
result.response.should be_an_instance_of Net::HTTPOK
|
|
288
|
+
result.parsed_response.should have_at_least(1).entry
|
|
289
|
+
result.parsed_response['server_name'] == 'krautchan100'
|
|
290
|
+
end
|
|
284
291
|
end
|
|
285
292
|
|
|
286
293
|
describe "Plesk" do
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hetzner-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 19
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 1
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 1.0.
|
|
9
|
+
- 2
|
|
10
|
+
version: 1.0.2
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Roland Moriz
|
|
@@ -15,8 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-
|
|
19
|
-
default_executable:
|
|
18
|
+
date: 2011-05-31 00:00:00 Z
|
|
20
19
|
dependencies:
|
|
21
20
|
- !ruby/object:Gem::Dependency
|
|
22
21
|
name: httparty
|
|
@@ -93,35 +92,39 @@ dependencies:
|
|
|
93
92
|
type: :development
|
|
94
93
|
version_requirements: *id005
|
|
95
94
|
- !ruby/object:Gem::Dependency
|
|
96
|
-
name:
|
|
95
|
+
name: rspec
|
|
97
96
|
prerelease: false
|
|
98
97
|
requirement: &id006 !ruby/object:Gem::Requirement
|
|
99
98
|
none: false
|
|
100
99
|
requirements:
|
|
101
100
|
- - ">="
|
|
102
101
|
- !ruby/object:Gem::Version
|
|
103
|
-
hash:
|
|
102
|
+
hash: 23
|
|
104
103
|
segments:
|
|
104
|
+
- 2
|
|
105
|
+
- 6
|
|
105
106
|
- 0
|
|
106
|
-
version:
|
|
107
|
+
version: 2.6.0
|
|
107
108
|
type: :development
|
|
108
109
|
version_requirements: *id006
|
|
109
110
|
- !ruby/object:Gem::Dependency
|
|
110
|
-
name:
|
|
111
|
+
name: guard-rspec
|
|
111
112
|
prerelease: false
|
|
112
113
|
requirement: &id007 !ruby/object:Gem::Requirement
|
|
113
114
|
none: false
|
|
114
115
|
requirements:
|
|
115
116
|
- - ">="
|
|
116
117
|
- !ruby/object:Gem::Version
|
|
117
|
-
hash:
|
|
118
|
+
hash: 17
|
|
118
119
|
segments:
|
|
119
120
|
- 0
|
|
120
|
-
|
|
121
|
+
- 3
|
|
122
|
+
- 1
|
|
123
|
+
version: 0.3.1
|
|
121
124
|
type: :development
|
|
122
125
|
version_requirements: *id007
|
|
123
126
|
- !ruby/object:Gem::Dependency
|
|
124
|
-
name:
|
|
127
|
+
name: growl
|
|
125
128
|
prerelease: false
|
|
126
129
|
requirement: &id008 !ruby/object:Gem::Requirement
|
|
127
130
|
none: false
|
|
@@ -135,19 +138,18 @@ dependencies:
|
|
|
135
138
|
type: :development
|
|
136
139
|
version_requirements: *id008
|
|
137
140
|
- !ruby/object:Gem::Dependency
|
|
138
|
-
name:
|
|
141
|
+
name: background_process
|
|
139
142
|
prerelease: false
|
|
140
143
|
requirement: &id009 !ruby/object:Gem::Requirement
|
|
141
144
|
none: false
|
|
142
145
|
requirements:
|
|
143
146
|
- - ">="
|
|
144
147
|
- !ruby/object:Gem::Version
|
|
145
|
-
hash:
|
|
148
|
+
hash: 11
|
|
146
149
|
segments:
|
|
150
|
+
- 1
|
|
147
151
|
- 2
|
|
148
|
-
|
|
149
|
-
- 0
|
|
150
|
-
version: 2.0.0
|
|
152
|
+
version: "1.2"
|
|
151
153
|
type: :development
|
|
152
154
|
version_requirements: *id009
|
|
153
155
|
- !ruby/object:Gem::Dependency
|
|
@@ -262,6 +264,7 @@ files:
|
|
|
262
264
|
- spec/fixtures/reset/post_with_ip_unknown.raw
|
|
263
265
|
- spec/fixtures/server/get.raw
|
|
264
266
|
- spec/fixtures/server/get_with_server_ip.raw
|
|
267
|
+
- spec/fixtures/server/post_with_server_name.raw
|
|
265
268
|
- spec/fixtures/subnet/get.raw
|
|
266
269
|
- spec/fixtures/subnet/get_with_server_ip.raw
|
|
267
270
|
- spec/fixtures/subnet/get_with_subnet_ip.raw
|
|
@@ -273,7 +276,6 @@ files:
|
|
|
273
276
|
- spec/hetzner_api_spec.rb
|
|
274
277
|
- spec/spec_constants.rb
|
|
275
278
|
- spec/spec_helper.rb
|
|
276
|
-
has_rdoc: true
|
|
277
279
|
homepage: http://moriz.de/opensource/hetzner-api
|
|
278
280
|
licenses: []
|
|
279
281
|
|
|
@@ -305,7 +307,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
305
307
|
requirements: []
|
|
306
308
|
|
|
307
309
|
rubyforge_project: hetzner-api
|
|
308
|
-
rubygems_version: 1.
|
|
310
|
+
rubygems_version: 1.8.3
|
|
309
311
|
signing_key:
|
|
310
312
|
specification_version: 3
|
|
311
313
|
summary: A wrapper for Hetzner.de's server management API
|