lib/gooddata/cli/commands/domain_cmd.rb in gooddata-0.6.7 vs lib/gooddata/cli/commands/domain_cmd.rb in gooddata-0.6.8
- old
+ new
@@ -10,36 +10,35 @@
c.desc 'Add user to domain'
c.command :add_user do |add_user|
add_user.action do |global_options, options, args|
opts = options.merge(global_options)
- GoodData.connect(opts)
+ client = GoodData.connect(opts)
domain = args[0]
- fail 'Domain name has to be provided' if domain.nil? || domain.empty?
+ fail ArgumentError, 'Domain name has to be provided' if domain.nil? || domain.empty?
email = args[1]
- fail 'Email has to be provided' if email.nil? || email.empty?
+ fail ArgumentError, 'Email has to be provided' if email.nil? || email.empty?
password = args[2]
- fail 'Password has to be provided' if password.nil? || password.empty?
+ fail ArgumentError, 'Password has to be provided' if password.nil? || password.empty?
- GoodData::Command::Domain.add_user(domain, email, password)
+ GoodData::Command::Domain.add_user(domain, email, password, :client => client)
end
end
c.desc 'List users in domain'
c.command :list_users do |list_users|
list_users.action do |global_options, options, args|
opts = options.merge(global_options)
- GoodData.connect(opts)
+ client = GoodData.connect(opts)
domain = args[0]
- fail 'Domain name has to be provided' if domain.nil? || domain.empty?
+ fail ArgumentError, 'Domain name has to be provided' if domain.nil? || domain.empty?
- users = GoodData::Command::Domain.list_users(domain)
- puts users.map { |u| [u['firstName'], u['lastName'], u['login']].join(',') }
+ users = GoodData::Command::Domain.list_users(domain, :client => client)
+ puts users.map { |u| [u.first_name, u.last_name, u.login].join(',') }
end
end
end
-
end