module Tapjoy::LDAP::CLI::User

CLI Module for all user commands

Constants

SUB_COMMANDS

Public Class Methods

commands() click to toggle source
# File lib/tapjoy/ldap/cli/user.rb, line 13
def commands
  Optimist.options do
    usage 'user [SUB_COMMAND] [options]'
    synopsis "\nThis object is used for user management\nAvailable subcommands are: #{SUB_COMMANDS}"

    stop_on SUB_COMMANDS
  end

  cmd = ARGV.shift

  case cmd
  when 'create', 'delete', 'index', 'show'
    send(cmd) # call method with respective name
  else
    raise Tapjoy::LDAP::InvalidArgument
  end
end
create() click to toggle source
# File lib/tapjoy/ldap/cli/user.rb, line 31
def create
  user = Tapjoy::LDAP::CLI::User::Create.new
  user.create
end
delete() click to toggle source
# File lib/tapjoy/ldap/cli/user.rb, line 36
def delete
  user = Tapjoy::LDAP::CLI::User::Delete.new
  user.delete
end
index() click to toggle source
# File lib/tapjoy/ldap/cli/user.rb, line 41
def index
  Tapjoy::LDAP::API::User.index.each do |entry|
    puts "DN: #{entry.dn}"
    entry.each do |attribute, values|
      puts "   #{attribute}:"
      values.each do |value|
        puts "      --->#{value}"
      end
    end
  end
end
show() click to toggle source
# File lib/tapjoy/ldap/cli/user.rb, line 53
def show
  user = Tapjoy::LDAP::CLI::User::Show.new
  user.show
end