lib/magellan/cli/resources/project.rb in magellan-cli-0.2.17 vs lib/magellan/cli/resources/project.rb in magellan-cli-0.2.18

- old
+ new

@@ -4,31 +4,31 @@ module Magellan module Cli module Resources class Project < Base - self.resource_name = "project" + self.resource_key = "project" self.resource_dependency = nil self.hidden_fields = %w[default_nebula_id created_at updated_at].map(&:freeze).freeze self.field_associations = {"organization_id" => {name: "organization", class: "Organization"} } - desc "update ATTRIBUTES", "update project with ATTRIBUTES" + desc "update ATTRIBUTES", "Update the ATTRIBUTES of the selected #{resource_name}" 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 - desc "create NAME", "create new project with NAME" + desc "create NAME", "Create a new #{resource_name} with NAME" 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) + post_json("/admin/#{resource_key}/new.json", params) select(name) end end end