hetzner-api 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -8,5 +8,4 @@ rvm:
8
8
  - rbx-18mode
9
9
  - rbx-19mode
10
10
  - ree
11
- - ruby-head
12
11
  script: rake test
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hetzner-api (1.0.4)
4
+ hetzner-api (1.0.5)
5
5
  httparty (~> 0.8.3)
6
6
  json
7
7
  thor
@@ -30,16 +30,16 @@ GEM
30
30
  gherkin (2.11.0)
31
31
  json (>= 1.4.6)
32
32
  growl (1.0.3)
33
- guard (1.1.1)
33
+ guard (1.2.3)
34
34
  listen (>= 0.4.2)
35
35
  thor (>= 0.14.6)
36
- guard-rspec (1.1.0)
36
+ guard-rspec (1.2.0)
37
37
  guard (>= 1.1)
38
38
  httparty (0.8.3)
39
39
  multi_json (~> 1.0)
40
40
  multi_xml
41
41
  json (1.7.3)
42
- listen (0.4.5)
42
+ listen (0.4.7)
43
43
  rb-fchange (~> 0.0.5)
44
44
  rb-fsevent (~> 0.9.1)
45
45
  rb-inotify (~> 0.8.8)
@@ -51,14 +51,14 @@ GEM
51
51
  rb-fsevent (0.9.1)
52
52
  rb-inotify (0.8.8)
53
53
  ffi (>= 0.5.0)
54
- rspec (2.10.0)
55
- rspec-core (~> 2.10.0)
56
- rspec-expectations (~> 2.10.0)
57
- rspec-mocks (~> 2.10.0)
58
- rspec-core (2.10.1)
59
- rspec-expectations (2.10.0)
54
+ rspec (2.11.0)
55
+ rspec-core (~> 2.11.0)
56
+ rspec-expectations (~> 2.11.0)
57
+ rspec-mocks (~> 2.11.0)
58
+ rspec-core (2.11.1)
59
+ rspec-expectations (2.11.2)
60
60
  diff-lcs (~> 1.1.3)
61
- rspec-mocks (2.10.1)
61
+ rspec-mocks (2.11.1)
62
62
  thor (0.15.3)
63
63
  xml-simple (1.1.1)
64
64
 
@@ -68,11 +68,11 @@ PLATFORMS
68
68
  DEPENDENCIES
69
69
  aruba
70
70
  background_process (~> 1.3)
71
- bundler (~> 1.1.4)
71
+ bundler (~> 1.1.5)
72
72
  cucumber (~> 1.2.1)
73
73
  fakeweb
74
74
  growl
75
- guard-rspec (~> 1.1.0)
75
+ guard-rspec (~> 1.2.0)
76
76
  hetzner-api!
77
77
  rake (~> 0.9.2.2)
78
- rspec (~> 2.10.0)
78
+ rspec (~> 2.11.0)
data/README.rdoc CHANGED
@@ -125,4 +125,6 @@ The gem and the author are not related to Hetzner AG!
125
125
 
126
126
  Copyright (c) 2012 Roland Moriz. See LICENSE for details.
127
127
 
128
- {Ruby on Rails Entwicklung}[http://moriz.de/] -> Moriz GmbH
128
+ {Ruby on Rails Freelancer}[https://roland.io/]
129
+
130
+ {Ruby on Rails Entwicklung}[https://moriz.de/] -> Moriz GmbH
data/hetzner-api.gemspec CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'json'
24
24
  s.add_dependency 'xml-simple'
25
25
 
26
- s.add_development_dependency "bundler", "~> 1.1.4"
27
- s.add_development_dependency "rspec", "~> 2.10.0"
28
- s.add_development_dependency "guard-rspec", "~> 1.1.0"
26
+ s.add_development_dependency "bundler", "~> 1.1.5"
27
+ s.add_development_dependency "rspec", "~> 2.11.0"
28
+ s.add_development_dependency "guard-rspec", "~> 1.2.0"
29
29
  s.add_development_dependency "growl"
30
30
  s.add_development_dependency "background_process", "~> 1.3"
31
31
  s.add_development_dependency "fakeweb"
data/lib/hetzner-api.rb CHANGED
@@ -11,6 +11,7 @@ require 'hetzner/api/server'
11
11
  require 'hetzner/api/ip'
12
12
  require 'hetzner/api/subnet'
13
13
  require 'hetzner/api/traffic'
14
+ require 'hetzner/api/boot/linux'
14
15
  require 'hetzner/api/boot/rescue'
15
16
  require 'hetzner/api/boot/vnc'
16
17
  require 'hetzner/api/boot/windows'
@@ -1,6 +1,7 @@
1
1
  module Hetzner
2
2
  class API
3
3
  module Boot
4
+ include Linux
4
5
  include Plesk
5
6
  include Rescue
6
7
  include VNC
@@ -0,0 +1,22 @@
1
+ module Hetzner
2
+ class API
3
+ module Boot
4
+ module Linux
5
+ def boot_linux?(ip)
6
+ path = "/boot/#{ip}/linux"
7
+ perform_get path
8
+ end
9
+
10
+ def boot_linux!(ip, dist, arch, lang)
11
+ path = "/boot/#{ip}/linux"
12
+ perform_post path, :query => {:dist => dist, :arch => arch, :lang => lang }
13
+ end
14
+
15
+ def disable_boot_linux!(ip)
16
+ path = "/boot/#{ip}/linux"
17
+ perform_delete path
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -1,5 +1,5 @@
1
1
  module Hetzner
2
2
  class API
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.5"
4
4
  end
5
5
  end
data/spec/api_stubs.rb CHANGED
@@ -77,6 +77,15 @@ FakeWeb.register_uri :post, uri("#{WORKING_IP}/plesk?arch=32&lang=en_US&dist=F
77
77
  FakeWeb.register_uri :delete, uri("#{WORKING_IP}/plesk"),
78
78
  :response => fixture('plesk/delete.raw')
79
79
 
80
+ FakeWeb.register_uri :get, uri("#{WORKING_IP}/linux"),
81
+ :response => fixture('linux/get.raw')
82
+
83
+ FakeWeb.register_uri :post, uri("#{WORKING_IP}/linux?dist=CentOS%206.3%20minimal&lang=en&arch=64"),
84
+ :response => fixture('linux/post.raw')
85
+
86
+ FakeWeb.register_uri :delete, uri("#{WORKING_IP}/linux"),
87
+ :response => fixture('linux/delete.raw')
88
+
80
89
 
81
90
  @resource = 'wol'
82
91
 
@@ -0,0 +1,13 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json
3
+
4
+ {
5
+ "linux": {
6
+ "server_ip": "11.11.11.111",
7
+ "dist": ["CentOS 5.8 minimal","CentOS 6.3 minimal","Debian 6.0 LAMP","Debian 6.0 minimal","openSUSE 12.2 minimal","Ubuntu 12.04 LTS minimal"],
8
+ "arch": [64,32],
9
+ "lang": ["en"],
10
+ "active": false,
11
+ "password": null
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json
3
+
4
+ {
5
+ "linux": {
6
+ "server_ip": "11.11.11.111",
7
+ "dist": ["CentOS 5.8 minimal","CentOS 6.3 minimal","Debian 6.0 LAMP","Debian 6.0 minimal","openSUSE 12.2 minimal","Ubuntu 12.04 LTS minimal"],
8
+ "arch": [64,32],
9
+ "lang": ["en"],
10
+ "active": false,
11
+ "password": null
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ HTTP/1.1 200 OK
2
+ Content-Type: application/json
3
+
4
+ {
5
+ "plesk": {
6
+ "server_ip": "11.11.11.111",
7
+ "dist": "CentOS 6.3 minimal",
8
+ "arch": 64,
9
+ "lang": "en",
10
+ "active": true,
11
+ "password": "ie8Nhz6R",
12
+ }
13
+ }
@@ -80,6 +80,27 @@ describe "Boot" do
80
80
  end
81
81
  end
82
82
 
83
+ describe "a linux system" do
84
+ before(:all) do
85
+ @hetzner_api = Hetzner::API.new API_USERNAME, API_PASSWORD
86
+ end
87
+
88
+ it "should be able to query the boot options" do
89
+ result = @hetzner_api.boot_linux? WORKING_IP
90
+ result.response.should be_an_instance_of Net::HTTPOK
91
+ end
92
+
93
+ it "should be able to activate the installation" do
94
+ result = @hetzner_api.boot_linux! WORKING_IP, "CentOS 6.3 minimal", "64", "en"
95
+ result.response.should be_an_instance_of Net::HTTPOK
96
+ end
97
+
98
+ it "should be able to deactivate the installation" do
99
+ result = @hetzner_api.disable_boot_linux! WORKING_IP
100
+ result.response.should be_an_instance_of Net::HTTPOK
101
+ end
102
+ end
103
+
83
104
  describe "the rescue system" do
84
105
  before(:all) do
85
106
  @h = Hetzner::API.new API_USERNAME, API_PASSWORD
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hetzner-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-26 00:00:00.000000000 Z
12
+ date: 2012-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: 1.1.4
85
+ version: 1.1.5
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: 1.1.4
93
+ version: 1.1.5
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rspec
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: 2.10.0
101
+ version: 2.11.0
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 2.10.0
109
+ version: 2.11.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: guard-rspec
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +114,7 @@ dependencies:
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.0
117
+ version: 1.2.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
@@ -122,7 +122,7 @@ dependencies:
122
122
  requirements:
123
123
  - - ~>
124
124
  - !ruby/object:Gem::Version
125
- version: 1.1.0
125
+ version: 1.2.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: growl
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -242,6 +242,7 @@ files:
242
242
  - hetzner-api.gemspec
243
243
  - lib/hetzner-api.rb
244
244
  - lib/hetzner/api/boot.rb
245
+ - lib/hetzner/api/boot/linux.rb
245
246
  - lib/hetzner/api/boot/plesk.rb
246
247
  - lib/hetzner/api/boot/rescue.rb
247
248
  - lib/hetzner/api/boot/vnc.rb
@@ -258,6 +259,9 @@ files:
258
259
  - lib/hetzner/api/wol.rb
259
260
  - spec/api_stubs.rb
260
261
  - spec/fixtures/boot/get_with_ip.raw
262
+ - spec/fixtures/boot/linux/delete.raw
263
+ - spec/fixtures/boot/linux/get.raw
264
+ - spec/fixtures/boot/linux/post.raw
261
265
  - spec/fixtures/boot/plesk/delete.raw
262
266
  - spec/fixtures/boot/plesk/get.raw
263
267
  - spec/fixtures/boot/plesk/post.raw
@@ -314,7 +318,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
314
318
  version: '0'
315
319
  segments:
316
320
  - 0
317
- hash: 2255137014396768646
321
+ hash: -1770334295152892560
318
322
  required_rubygems_version: !ruby/object:Gem::Requirement
319
323
  none: false
320
324
  requirements: