Class: HammerCLIForeman::DownloadCommand
- Inherits:
-
SingleResourceCommand
- Object
- SingleResourceCommand
- HammerCLIForeman::DownloadCommand
show all
- Defined in:
- lib/hammer_cli_foreman/commands.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.command_name(name = nil) ⇒ Object
730
731
732
|
# File 'lib/hammer_cli_foreman/commands.rb', line 730
def self.command_name(name = nil)
super(name) || "download"
end
|
Instance Method Details
#default_filename ⇒ Object
756
757
758
|
# File 'lib/hammer_cli_foreman/commands.rb', line 756
def default_filename
"Downloaded-#{Time.new.strftime("%Y-%m-%d")}.txt"
end
|
#execute ⇒ Object
741
742
743
744
745
746
747
748
749
750
|
# File 'lib/hammer_cli_foreman/commands.rb', line 741
def execute
response = send_request
if option_path
filepath = store_response(response)
print_message(saved_response_message(filepath))
else
puts response.body
end
return HammerCLI::EX_OK
end
|
#request_options ⇒ Object
734
735
736
|
# File 'lib/hammer_cli_foreman/commands.rb', line 734
def request_options
{ :response => :raw }
end
|
#saved_response_message(filepath) ⇒ Object
752
753
754
|
# File 'lib/hammer_cli_foreman/commands.rb', line 752
def saved_response_message(filepath)
_("The response has been saved to %{path}.") % { path: filepath }
end
|