solusvm 0.4.3 → 0.5.1
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/.gitignore +2 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +13 -0
- data/VERSION.yml +2 -2
- data/lib/solusvm/base.rb +1 -0
- data/lib/solusvm/client.rb +13 -1
- data/solusvm.gemspec +7 -2
- data/test/fixtures/client_change_password_error.txt +2 -0
- data/test/fixtures/client_change_password_success.txt +4 -0
- data/test/fixtures/client_exists_success.txt +2 -0
- data/test/test_client.rb +13 -0
- data/test/test_server.rb +2 -2
- metadata +9 -4
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/VERSION.yml
CHANGED
data/lib/solusvm/base.rb
CHANGED
data/lib/solusvm/client.rb
CHANGED
@@ -14,10 +14,22 @@ module Solusvm
|
|
14
14
|
perform_request(options)
|
15
15
|
end
|
16
16
|
|
17
|
+
# change client password for the solus admin
|
18
|
+
def change_password(username, password)
|
19
|
+
perform_request({:action => "client-updatepassword", :username => username, :password => password})
|
20
|
+
statusmsg.match /success/i
|
21
|
+
end
|
22
|
+
|
23
|
+
# checks wether a specific client exists
|
24
|
+
def exists?(username)
|
25
|
+
perform_request({:action => 'client-checkexists', :username => username})
|
26
|
+
statusmsg.match /client exists/i
|
27
|
+
end
|
28
|
+
|
17
29
|
# Verify a clients login. Returns true when the specified login is correct
|
18
30
|
def authenticate(username, password)
|
19
31
|
perform_request({:action => 'client-authenticate', :username => username, :password => password})
|
20
32
|
statusmsg.match /validated/i
|
21
33
|
end
|
22
34
|
end
|
23
|
-
end
|
35
|
+
end
|
data/solusvm.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{solusvm}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Justin Mazzi"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-24}
|
13
13
|
s.default_executable = %q{solusvm}
|
14
14
|
s.description = %q{Solusvm allows for easy interaction with the SolusVM Admin::API.}
|
15
15
|
s.email = %q{jmazzi@gmail.com}
|
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = [
|
22
22
|
".document",
|
23
23
|
".gitignore",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
24
26
|
"LICENSE",
|
25
27
|
"README.rdoc",
|
26
28
|
"Rakefile",
|
@@ -36,8 +38,11 @@ Gem::Specification.new do |s|
|
|
36
38
|
"solusvm.gemspec",
|
37
39
|
"test/fixtures/client_authenticate_error.txt",
|
38
40
|
"test/fixtures/client_authenticate_success.txt",
|
41
|
+
"test/fixtures/client_change_password_error.txt",
|
42
|
+
"test/fixtures/client_change_password_success.txt",
|
39
43
|
"test/fixtures/client_create_error.txt",
|
40
44
|
"test/fixtures/client_create_success.txt",
|
45
|
+
"test/fixtures/client_exists_success.txt",
|
41
46
|
"test/fixtures/error.txt",
|
42
47
|
"test/fixtures/general_node_statistics_success.txt",
|
43
48
|
"test/fixtures/general_nodes_success.txt",
|
data/test/test_client.rb
CHANGED
@@ -29,6 +29,19 @@ class TestClient < Test::Unit::TestCase
|
|
29
29
|
assert ! @client.create
|
30
30
|
assert_equal 'Empty username field', @client.statusmsg
|
31
31
|
end
|
32
|
+
|
33
|
+
def test_exists
|
34
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=client-checkexists&username=vps123", :body => load_response('client_exists_success'))
|
35
|
+
assert @client.exists?("vps123")
|
36
|
+
assert_equal 'Client exists', @client.statusmsg
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_change_password
|
40
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=client-updatepassword&username=vps123&password=123456", :body => load_response('client_change_password_success'))
|
41
|
+
FakeWeb.register_uri(:get, "#{base_uri}&action=client-updatepassword&username=vps13&password=thecake", :body => load_response('client_change_password_error'))
|
42
|
+
assert @client.change_password("vps123","123456")
|
43
|
+
assert !@client.change_password("vps13","thecake")
|
44
|
+
end
|
32
45
|
|
33
46
|
def test_authenticate
|
34
47
|
FakeWeb.register_uri(:get, "#{base_uri}&action=client-authenticate&username=u&password=p", :body => load_response('client_authenticate_success'))
|
data/test/test_server.rb
CHANGED
@@ -70,9 +70,9 @@ class TestServer < Test::Unit::TestCase
|
|
70
70
|
assert_equal 'Virtual server terminated', @server.statusmsg
|
71
71
|
end
|
72
72
|
|
73
|
-
def
|
73
|
+
def test_exists
|
74
74
|
FakeWeb.register_uri(:get, "#{base_uri}&action=vserver-checkexists&vserverid=1", :body => load_response('server_exists_success'))
|
75
|
-
assert @server.exists(1)
|
75
|
+
assert @server.exists?(1)
|
76
76
|
assert_equal 'Virtual server exists', @server.statusmsg
|
77
77
|
end
|
78
78
|
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 1
|
10
|
+
version: 0.5.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Justin Mazzi
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-24 00:00:00 -04:00
|
19
19
|
default_executable: solusvm
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -44,6 +44,8 @@ extra_rdoc_files:
|
|
44
44
|
files:
|
45
45
|
- .document
|
46
46
|
- .gitignore
|
47
|
+
- Gemfile
|
48
|
+
- Gemfile.lock
|
47
49
|
- LICENSE
|
48
50
|
- README.rdoc
|
49
51
|
- Rakefile
|
@@ -59,8 +61,11 @@ files:
|
|
59
61
|
- solusvm.gemspec
|
60
62
|
- test/fixtures/client_authenticate_error.txt
|
61
63
|
- test/fixtures/client_authenticate_success.txt
|
64
|
+
- test/fixtures/client_change_password_error.txt
|
65
|
+
- test/fixtures/client_change_password_success.txt
|
62
66
|
- test/fixtures/client_create_error.txt
|
63
67
|
- test/fixtures/client_create_success.txt
|
68
|
+
- test/fixtures/client_exists_success.txt
|
64
69
|
- test/fixtures/error.txt
|
65
70
|
- test/fixtures/general_node_statistics_success.txt
|
66
71
|
- test/fixtures/general_nodes_success.txt
|