lib/magellan/cli/resources/client_version.rb in magellan-cli-0.2.19 vs lib/magellan/cli/resources/client_version.rb in magellan-cli-0.3.0

- old
+ new

@@ -14,20 +14,29 @@ "stage_title_id" => {name: "stage", class: "Stage"}, } desc "create VERSION", "Create a new #{resource_name}" def create(version) - stage = load_selection!("stage") + stage = load_selection!(Stage) params = { parameter_name => { "stage_title_id" => stage["id"], "version" => version, } } post_json("/admin/#{resource_key}/new.json", params) # TODO implement select method # select(version) end + + desc "delete VERSION", "Delete the #{resource_name} specified by VERSION" + def delete(version) + q = build_query("version" => version).update(default_query) + r = get_first_result!(self.class.resource_name, "/admin/#{resource_key}.json", q) + super("/admin/#{resource_key}/#{r['id']}/delete") + log_success("OK") + end + end end end end