Class: HammerCLIForeman::InfoCommand

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

alias_name_for_resource, build_options, connection_name, create_option_builder, #customized_options, #dependency_resolver, dependency_resolver, #exception_handler_class, #get_identifier, #get_resource_id, #get_resource_ids, #request_params, resolver, #resolver, resource_alias_name_mapping, resource_config, resource_name_mapping, #searchables, searchables, #transform_format

Class Method Details

.command_names(*names) ⇒ Object



505
506
507
# File 'lib/hammer_cli_foreman/commands.rb', line 505

def self.command_names(*names)
  super(*names) || %w(info show)
end

.output(definition = nil, &block) ⇒ Object



496
497
498
499
500
501
502
503
# File 'lib/hammer_cli_foreman/commands.rb', line 496

def self.output(definition = nil, &block)
  super
  begin
    output_definition.update_field_sets('THIN', (searchables.for(resource).map(&:name) + ['id']).map(&:to_sym))
  rescue StandardError => e
    # Some subcommands may not have such fields or defined resource
  end
end

Instance Method Details

#extend_data(record) ⇒ Object



514
515
516
# File 'lib/hammer_cli_foreman/commands.rb', line 514

def extend_data(record)
  record
end


518
519
520
# File 'lib/hammer_cli_foreman/commands.rb', line 518

def print_data(record)
  print_record(output_definition, record)
end

#send_requestObject



509
510
511
512
# File 'lib/hammer_cli_foreman/commands.rb', line 509

def send_request
  record = super
  extend_data(record)
end