Sha256: 270aa55bc637afa1039d12a9afbc30e50cce6103cd72ad7f6eec00c4b6ddb9f3

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

module Solusvm 
  class ClientCli < BaseCli

    desc "create", "Creates a new client"
    method_option :username, :type => :string, :desc => "Username",  :aliases => ["-u", "--username"]
    method_option :password, :type => :string, :desc => "Password",  :aliases => ["-p", "--password"]
    method_option :email, :type => :string, :desc => "Email",  :aliases => ["-e", "--email"]
    method_option :firstname, :type => :string, :desc => "Firstname",  :aliases => ["-f", "--firstname"]
    method_option :lastname, :type => :string, :desc => "Lastname",  :aliases => ["-l", "--lastname"]
    method_option :company, :type => :string, :desc => "Company",  :aliases => ["-c", "--company"]
    def create
      say client.create(options)
    end

    desc "change-password USERNAME NEWPASSWORD", "Changes the password of an existing client"
    def change_password(username, password)
      say client.change_password(username, password)
    end

    desc "authenticate USERNAME NEWPASSWORD", "Verify a clients login. Returns true when the specified login is correct"
    def authenticate(username, password)
      say client.authenticate(username, password)
    end

    desc "check-exists USERNAME", "Checks if a client exists"
    def check_exists(username)
      say client.exists?(username)
    end

    desc "delete USERNAME", "Deletes an existing client"
    def delete(username)
      say client.delete(username)
    end

    desc "list", "Lists existing clients"
    def list
      say client.list
    end

    private

    def client
      @client ||= begin
        configure
        Solusvm::Client.new
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
solusvm-1.0.0.beta3 lib/solusvm/cli/client_cli.rb
solusvm-1.0.0.beta2 lib/solusvm/cli/client_cli.rb
solusvm-1.0.0.beta lib/solusvm/cli/client_cli.rb