Class: EPC::Command::UpdateSolutionCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- EPC::Command::UpdateSolutionCommand
- Defined in:
- lib/epc/command/solution/update_solution_command.rb
Constant Summary collapse
- UPDATABLE_ATTRIBUTES =
["name"]
Constants inherited from BaseCommand
BaseCommand::GIVEUP_TICKS, BaseCommand::SLEEP_TIME, BaseCommand::TICKER_TICKS
Instance Attribute Summary
Attributes inherited from BaseCommand
#client, #klass_name, #object_id, #object_type, #options, #target_id, #target_type
Instance Method Summary collapse
Methods inherited from BaseCommand
#check_options, #context_params, #context_params=, #go, include_module, inherited, #initialize, required_options, #say_err
Methods included from PersistentAttributes
#auth_token, #caller_id, #target_url
Constructor Details
This class inherits a constructor from EPC::Command::BaseCommand
Instance Method Details
#execute(args) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/epc/command/solution/update_solution_command.rb', line 5 def execute(args) require_object path = File.(".") path = project_solution_path(path) args_hash = {} args.each do |arg| key, val = arg.split("=") next if key.nil? args_hash[key] = val end if @options[:file].present? args_hash = EPC::Config.read_content_as_json(@options[:file]).merge(args_hash) end args_hash.each do |attr, val| unless UPDATABLE_ATTRIBUTES.include?(attr) args_hash.delete(attr) say("Cannot update #{attr}. Updatable attributes are: #{UPDATABLE_ATTRIBUTES.join(',')}") next end end if args_hash.present? status, response, = client.put(EPC::Config::SOLUTIONS_PATH + "/#{object_id}", args_hash) if status.failure? say_err("Update failed with: [#{response['message']}]") else say("Update succesful") end return status end end |