Class: EPC::Command::UnarchiveSolutionCommand

Inherits:
UnarchiveCommand show all
Defined in:
lib/epc/command/solution/unarchive_solution_command.rb

Constant Summary

Constants inherited from BaseCommand

BaseCommand::GIVEUP_TICKS, BaseCommand::SLEEP_TIME, BaseCommand::TICKER_TICKS

Instance Attribute Summary

Attributes inherited from BaseCommand

#client, #options

Instance Method Summary collapse

Methods inherited from BaseCommand

#go, inherited, #initialize, required_options

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(solution_name = nil) ⇒ Object

Raises:



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/epc/command/solution/unarchive_solution_command.rb', line 3

def execute(solution_name = nil)
  path = "."
  path = File.expand_path(path)

  solution_id, solution_name = infer_solution_context(solution_name, path, {:get_solution_name => true})

  raise FatalError, "Solution could not be inferred" if solution_id.nil?

  status, response, message = client.put(EPC::Config::SOLUTIONS_PATH + "/#{solution_id}", {:archived => false, :name => solution_name})
  if status.successful?
    say("Solution has been unarchived.")
  else
    say("Solution could not be unarchived. Request failed with: [#{response[:message]}]")
  end
  return status
end