Class: HammerCLIForeman::AddAssociatedCommand

Inherits:
AssociatedCommand show all
Defined in:
lib/hammer_cli_foreman/commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AssociatedCommand

apipie_options, associated_identifiers, associated_resource, #associated_resource, declared_associated_identifiers, #get_current_ids, #get_required_id, #request_params, setup_associated_identifier_options, #validate_options

Methods inherited from WriteCommand

#request_headers, #send_request

Class Method Details

.command_name(name = nil) ⇒ Object



265
266
267
# File 'lib/hammer_cli_foreman/commands.rb', line 265

def self.command_name(name=nil)
  super(name) || (associated_resource ? "add_"+associated_resource.name : nil)
end

.desc(desc = nil) ⇒ Object



269
270
271
# File 'lib/hammer_cli_foreman/commands.rb', line 269

def self.desc(desc=nil)
  "Associate a resource"
end

Instance Method Details

#get_new_idsObject



273
274
275
276
277
278
279
# File 'lib/hammer_cli_foreman/commands.rb', line 273

def get_new_ids
  ids = get_current_ids
  required_id = get_required_id

  ids << required_id unless ids.include? required_id
  ids
end