lib/lita/handlers/eval.rb in lita-eval-0.1.0 vs lib/lita/handlers/eval.rb in lita-eval-0.2.0

- old
+ new

@@ -7,14 +7,13 @@ 'eval CODE' => 'Evaluates the given ruby code.' } def evaluate(response) code = response.matches[0][0] - http_response = http.post 'http://eval.so/api/evaluate' do |req| - req.headers['Content-Type'] = 'application/json' - req.body = MultiJson.dump(language: 'ruby', code: "p(#{code})") + http_response = http.put 'http://tryruby.org/levels/1/challenges/0/play' do |req| + req.body = {cmd: code} end - response.reply MultiJson.load(http_response.body)['stdout'].strip + response.reply MultiJson.load(http_response.body)['output'] end end Lita.register_handler(Eval) end