Class: Central::Cli::Master::Users::InviteCommand

Inherits:
Clamp::Command
  • Object
show all
Includes:
Common
Defined in:
lib/central/cli/master/users/invite_command.rb

Instance Method Summary collapse

Methods included from Common

#access_token=, #add_master, #api_url, #api_url=, #clear_current_stack, #client, #current_master, #current_master=, #current_master_index, #current_stack, #current_stack=, #ensure_custom_ssl_ca, #require_api_url, #require_current_stack, #require_token, #reset_client, #save_settings, #settings, #settings_filename

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/central/cli/master/users/invite_command.rb', line 9

def execute
  require_api_url
  token = require_token
  email_list.each do |email|
    begin
      data = { email: email }
      response = client(token).post('users', data)
      puts "Invitation send to #{email}"
    rescue
      puts "Failed to invite #{email}".colorize(:red)
      puts exec.message
    end
  end
end