Class: Magellan::Cli::Resources::Team

Inherits:
Base
  • Object
show all
Includes:
Deletable
Defined in:
lib/magellan/cli/resources/team.rb

Constant Summary

Constants included from FileAccess

FileAccess::DEFAULT_SELECTION_FILENAME

Instance Method Summary collapse

Methods included from Deletable

included

Methods included from FileAccess

ensure_config_dir, load_selection, load_selections, remove_selection_file, selection_filename, update_selections

Methods inherited from Base

command_help, help, log_error, log_info, log_success, log_verbose, log_warning, puts_with_color, sorted_commands, sorted_printable_commands, update_common_help_message

Instance Method Details

#create(name, role) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/magellan/cli/resources/team.rb', line 16

def create(name, role)
  unless %w{ reader admin }.include?(role)
    raise "ROLE should be 'reader' or 'admin'"
  end
  o = load_selection!(Organization)
  params = {
    parameter_name => {
      "organization_id" => o["id"],
      "name" => name,
      "role" => role,
    }
  }
  post_json("/admin/#{self.resource_key}/new.json", params)
  select(name)
end