Class: Magellan::Cli::Resources::Project

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

Instance Method Summary collapse

Methods included from FileAccess

#load_selection, #load_selections, #update_selections

Instance Method Details

#create(name) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/magellan/cli/resources/project.rb', line 22

def create(name)
  o = load_selection(Organization.parameter_name)
  params = {
    parameter_name => {
      "organization_id" => o["id"],
      "name" => name,
    }
  }
  post_json("/admin/#{resource_name}/new.json", params)
  select(name)
end

#update(attrs) ⇒ Object



15
16
17
18
19
# File 'lib/magellan/cli/resources/project.rb', line 15

def update(attrs)
  s = load_selection("project")
  attrs = JSON.parse(File.readable?(attrs) ? File.read(attrs) : attrs)
  put_json("/admin/project/#{s['id']}/edit", {"project" => attrs})
end