<commit_before>require 'rubygems'
require "bundler/setup"
dir = Pathname(__FILE__).dirname.expand_path
require dir + 'lib/ragios'
require dir + 'config'
require 'sinatra' 
require 'yajl'


get '/' do
 "Ragios Server"
end


put '/ragios/monitor' do

  monitors = Yajl::Parser.parse(request.body.read, :symbolize_keys => true)
  Ragios::Monitor.start monitors

  "{\"ok\":true}"
end<commit_msg>Keeping it JSON all the way<commit_after>require 'rubygems'
require "bundler/setup"
dir = Pathname(__FILE__).dirname.expand_path
require dir + 'lib/ragios'
require dir + 'config'
require 'sinatra' 
require 'yajl'


get '/' do

  Yajl::Encoder.encode({ Ragios: "welcome"})

end


put '/ragios/monitors' do
 begin
  monitors = Yajl::Parser.parse(request.body.read, :symbolize_keys => true)
  Ragios::Monitor.start monitors
  Yajl::Encoder.encode({ok:"true"})
 rescue 
    Yajl::Encoder.encode({error: $!.to_s})
 end
end

get '/ragios/monitors' do
   #convert each monitor into a hash
   #Ragios::Monitor.get_monitors
end

not_found do
     Yajl::Encoder.encode({error:"not found"})
end
{'fraction_non_alphanumeric': 0.14232558139534884, 'fraction_numerical': 0.0, 'mean_word_length': 4.8478260869565215, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3257074', 'n_tokens_mistral': 401, 'n_tokens_neox': 385, 'n_words': 90}