Class: HammerCLIForeman::CommonParameter::SetCommand
Instance Attribute Summary collapse
Instance Method Summary
collapse
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, resolver, #resolver, resource_alias_name_mapping, resource_config, resource_name_mapping, #searchables, searchables, #send_request, #transform_format
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
35
36
37
|
# File 'lib/hammer_cli_foreman/common_parameter.rb', line 35
def action
@action
end
|
Instance Method Details
#execute ⇒ Object
37
38
39
40
|
# File 'lib/hammer_cli_foreman/common_parameter.rb', line 37
def execute
@action ||= parameter_exist? ? :update : :create
super
end
|
#parameter_exist? ⇒ Boolean
46
47
48
49
50
|
# File 'lib/hammer_cli_foreman/common_parameter.rb', line 46
def parameter_exist?
params = resource.call(:index)
params = HammerCLIForeman.collection_to_common_format(params)
params.find { |p| p["name"] == option_name }
end
|
#request_params ⇒ Object
52
53
54
|
# File 'lib/hammer_cli_foreman/common_parameter.rb', line 52
def request_params
super.update('id' => option_name)
end
|
#success_message ⇒ Object
42
43
44
|
# File 'lib/hammer_cli_foreman/common_parameter.rb', line 42
def success_message
success_message_for(action)
end
|