solusvm 0.4.3 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -20,3 +20,5 @@ pkg
20
20
 
21
21
  ## PROJECT::SPECIFIC
22
22
  .rvmrc
23
+
24
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'http://rubygems.org'
2
+ gem 'xml-simple'
@@ -0,0 +1,13 @@
1
+ ---
2
+ dependencies:
3
+ xml-simple:
4
+ group:
5
+ - :default
6
+ version: ">= 0"
7
+ specs:
8
+ - xml-simple:
9
+ version: 1.0.12
10
+ hash: 386a7600abde8b96658948bfd5351cf687923086
11
+ sources:
12
+ - Rubygems:
13
+ uri: http://rubygems.org
@@ -1,5 +1,5 @@
1
1
  ---
2
- :minor: 4
2
+ :patch: 1
3
3
  :build:
4
- :patch: 3
5
4
  :major: 0
5
+ :minor: 5
@@ -25,6 +25,7 @@ module Solusvm
25
25
  http.start do |http|
26
26
  request = Net::HTTP::Get.new("#{api_endpoint.path}?#{options.to_query}")
27
27
  response = http.request(request)
28
+
28
29
  @returned_parameters = parse_response(response.body)
29
30
  log_messages(options)
30
31
  end
@@ -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
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{solusvm}
8
- s.version = "0.4.3"
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-08}
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",
@@ -0,0 +1,2 @@
1
+ <status>error</status>
2
+ <statusmsg>error message</statusmsg>
@@ -0,0 +1,4 @@
1
+ <status>success</status>
2
+ <statusmsg>Successfully updated client password</statusmsg>
3
+ <username>vps123</username>
4
+ <password>123456</password>
@@ -0,0 +1,2 @@
1
+ <status>success</status>
2
+ <statusmsg>Client exists</statusmsg>
@@ -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'))
@@ -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 text_exists
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
- - 4
9
- - 3
10
- version: 0.4.3
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-08 00:00:00 -04:00
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