Sha256: a0b395cc1f380ff3b424689b8dfc6ab5878faa003def8af9173d03e952299036

Contents?: true

Size: 1.47 KB

Versions: 7

Compression:

Stored size: 1.47 KB

Contents

module Solusvm
  # Solusvm::Client is the class for working with clients.
  class Client < Base
    # Creates a client.
    #
    # Options:
    #
    # * <tt>:username</tt>
    # * <tt>:password</tt>
    # * <tt>:email</tt>
    # * <tt>:firstname</tt>
    # * <tt>:lastname</tt>
    # * <tt>:company</tt>
    def create(options ={})
      perform_request(options.merge(:action => 'client-create')) && returned_parameters
    end

    # Change client password for the solus admin.
    def change_password(username, new_password)
      perform_request({:action => "client-updatepassword", :username => username, :password => new_password})
    end

    # Checks wether a specific client exists.
    def exists?(username)
      perform_request({:action => 'client-checkexists', :username => username})
    end

    # Verify a clients login. Returns true when the specified login is correct.
    def authenticate(username, password)
      perform_request({:action => 'client-authenticate', :username => username, :password => password})
    end

    # Deletes an existing client.
    def delete(username)
      perform_request({:action => "client-delete", :username => username})
    end

    # Lists existing clients.
    def list
      perform_request({:action => "client-list"}, "client")

      if returned_parameters["clients"] && returned_parameters["clients"]["client"]
        returned_parameters["clients"]["client"]
      elsif returned_parameters["clients"]
        []
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solusvm-1.2.1 lib/solusvm/client.rb
solusvm-1.2.0 lib/solusvm/client.rb
solusvm-1.1.0.beta2 lib/solusvm/client.rb
solusvm-1.1.0.beta1 lib/solusvm/client.rb
solusvm-1.0.0.beta3 lib/solusvm/client.rb
solusvm-1.0.0.beta2 lib/solusvm/client.rb
solusvm-1.0.0.beta lib/solusvm/client.rb