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

Inherits:
Base show all
Defined in:
lib/magellan/cli/resources/team.rb

Instance Method Summary collapse

Methods included from FileAccess

#load_selection, #load_selections, #update_selections

Instance Method Details

#create(name, role) ⇒ Object



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

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