Class: Magellan::Cli::Resources::ClientVersion

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

Constant Summary

Constants included from FileAccess

FileAccess::DEFAULT_SELECTION_FILENAME

Instance Method Summary collapse

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, puts_with_color, sorted_commands, sorted_printable_commands, update_common_help_message

Instance Method Details

#create(version) ⇒ Object



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

def create(version)
  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

#delete(version) ⇒ Object



33
34
35
36
37
38
# File 'lib/magellan/cli/resources/client_version.rb', line 33

def delete(version)
  q = build_query("version" => version).update(default_query)
  r = get_first_result!(self.class.resource_name, version, "/admin/#{resource_key}.json", q)
  super("/admin/#{resource_key}/#{r['id']}/delete")
  log_success("OK")
end