// Generated by CoffeeScript 1.12.7
var Example, asciify, fs;

fs = require('fs');

asciify = require('asciify');

Example = (function() {
  function Example() {}

  Example.prototype.main = function(info) {
    var asciiText, body, dumpfile, queryStringParameters, ref, ref1, ref2, text;
    info.paths = module.paths;
    info.env = process.env;
    queryStringParameters = info.request.query_string_parameters;
    dumpfile = queryStringParameters != null ? (ref = queryStringParameters.dump_request) != null ? ref[0] : void 0 : void 0;
    if (dumpfile) {
      fs.appendFileSync(dumpfile, info.request.body);
      body = "Info was successfully stored into file: " + dumpfile + ".";
      return ez5.respondSuccess(body);
    } else if (asciiText = queryStringParameters != null ? (ref1 = queryStringParameters.ascii) != null ? ref1[0] : void 0 : void 0) {
      text = asciiText || "Hello!";
      return asciify(text, {
        color: 'green'
      }, (function(_this) {
        return function(err, res) {
          return ez5.respondSuccess(res);
        };
      })(this));
    } else if (body = queryStringParameters != null ? (ref2 = queryStringParameters.body) != null ? ref2[0] : void 0 : void 0) {
      return ez5.respondSuccess(JSON.stringify(JSON.parse(info.request.body), null, 4) + "\n");
    } else {
      return ez5.respondSuccess(info);
    }
  };

  return Example;

})();

module.exports = new Example();
