 #   hubot rundeck output <id> - Print the output of execution <id>
 #
 # Notes:
+#   REQUIRES Rundeck API version 12
 #   Todo:
 #     * make job name lookups case-insensitive
 #     * ability to show results of a job/execution

      rundeck.jobs().run name, null, (job, results) ->
        if job
          robot.logger.debug inspect(results, false, null)
          msg.send "Running job #{name}: #{results.result.executions[0].execution[0]['$'].href}"
        else
          msg.send "Could not execute Rundeck job \"#{name}\"."
    else

  constructor: (@robot) ->
    @logger = @robot.logger

    @baseUrl = "#{process.env.HUBOT_RUNDECK_URL}/api/12"
    @authToken = process.env.HUBOT_RUNDECK_TOKEN
    @project = process.env.HUBOT_RUNDECK_PROJECT
    @adminRole = "rundeck_admin"
