module Morpheus::Cli::SecondaryRestCommand::ClassMethods

Public Instance Methods

default_rest_parent_arg() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 78
def default_rest_parent_arg
  rest_parent_key.to_s.gsub("_", " ")
end
default_rest_parent_has_name() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 109
def default_rest_parent_has_name
  true
end
default_rest_parent_interface_name() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 155
def default_rest_parent_interface_name
  rest_parent_name
end
default_rest_parent_key() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 64
def default_rest_parent_key
  rest_parent_name.chomp("s")
end
default_rest_parent_label() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 124
def default_rest_parent_label
  rest_parent_key.to_s.split("_").collect {|it| it.to_s.capitalize }.join(" ")
end
default_rest_parent_label_plural() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 139
def default_rest_parent_label_plural
  #rest_parent_name.to_s.split("_").collect {|it| it.to_s.capitalize }.join(" ")
  rest_parent_label.to_s.pluralize
end
default_rest_parent_name() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 39
def default_rest_parent_name
  words = rest_name.split("_")
  if words.size > 1
    words.pop
    return words.join("_") + "s"
  else
    # this wont happen, default wont make sense in this scenario
    # "parent_" + rest_name
    raise "Unable to determine default_rest_parent_name for rest_name: #{rest_name}, class: #{self}"
  end
end
default_rest_parent_param() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 92
def default_rest_parent_param
  param = rest_parent_key.to_s.split('_').collect(&:capitalize).join
  "#{param[0].downcase}#{param[1..-1]}Id"
end
rest_parent_arg() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 74
def rest_parent_arg
  defined?(@rest_parent_arg) ? @rest_parent_arg : default_rest_parent_arg
end
rest_parent_arg=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 82
def rest_parent_arg=(v)
  @rest_parent_arg = v.to_s
end
Also aliased as: set_rest_parent_arg
rest_parent_has_name() click to toggle source

rest_parent_has_name indicates a resource has a name and can be retrieved by name or id true by default, set to false for lookups by only id

# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 105
def rest_parent_has_name
  defined?(@rest_parent_has_name) ? @rest_parent_has_name : default_rest_parent_has_name
end
rest_parent_has_name=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 113
def rest_parent_has_name=(v)
  @rest_parent_has_name = !!v
end
Also aliased as: set_rest_parent_has_name
rest_parent_interface_name() click to toggle source

the name of the default interface, matches the rest name eg. “neat_things”

# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 151
def rest_parent_interface_name
  defined?(@rest_parent_interface_name) ? @rest_parent_interface_name : default_rest_parent_interface_name
end
rest_parent_interface_name=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 159
def rest_parent_interface_name=(v)
  @rest_parent_interface_name = v.to_s
end
rest_parent_key() click to toggle source

rest_parent_key is the singular name of the resource eg. “neat_thing”

# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 60
def rest_parent_key
  defined?(@rest_parent_key) ? @rest_parent_key : default_rest_parent_key
end
rest_parent_key=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 68
def rest_parent_key=(v)
  @rest_parent_key = v.to_s
end
Also aliased as: set_rest_parent_key
rest_parent_label() click to toggle source

rest_parent_label is the capitalized resource label eg. “Neat Thing”

# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 120
def rest_parent_label
  defined?(@rest_parent_label) ? @rest_parent_label : default_rest_parent_label
end
rest_parent_label=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 128
def rest_parent_label=(v)
  @rest_parent_label = v.to_s
end
Also aliased as: set_rest_parent_label
rest_parent_label_plural() click to toggle source

the plural version of the label eg. “Neat Things”

# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 135
def rest_parent_label_plural
  defined?(@rest_parent_label_plural) ? @rest_parent_label_plural : default_rest_parent_label_plural
end
rest_parent_label_plural=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 144
def rest_parent_label_plural=(v)
  @rest_parent_label_plural = v.to_s
end
Also aliased as: set_rest_parent_label_plural
rest_parent_name() click to toggle source

rest_parent_name is the rest_name for the parent

# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 35
def rest_parent_name
  defined?(@rest_parent_name) ? @rest_parent_name : default_rest_parent_name
end
rest_parent_name=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 51
def rest_parent_name=(v)
  @rest_parent_name = v.to_s
end
rest_parent_param() click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 88
def rest_parent_param
  defined?(@rest_parent_param) ? @rest_parent_param : default_rest_parent_param
end
rest_parent_param=(v) click to toggle source
# File lib/morpheus/cli/mixins/secondary_rest_command.rb, line 97
def rest_parent_param=(v)
  @rest_parent_param = v.to_s
end
Also aliased as: set_rest_parent_param
set_rest_parent(v)
Alias for: rest_parent_name=
set_rest_parent_arg(v)
Alias for: rest_parent_arg=
set_rest_parent_has_name(v)
set_rest_parent_interface_name(v)
set_rest_parent_key(v)
Alias for: rest_parent_key=
set_rest_parent_label(v)
Alias for: rest_parent_label=
set_rest_parent_label_plural(v)
set_rest_parent_name(v)
Alias for: rest_parent_name=
set_rest_parent_param(v)
Alias for: rest_parent_param=