class CSGOLytics::HTTPServlet

Public Class Methods

new(server, backend) click to toggle source
Calls superclass method
# File lib/csgolytics/http_server.rb, line 5
def initialize(server, backend)
  super server
  @backend = backend
end

Public Instance Methods

do_POST(request, response) click to toggle source
# File lib/csgolytics/http_server.rb, line 10
def do_POST (request, response)
  if request.path == "/api/v1/insert_logline"
    @backend.insert_logline request.body.force_encoding("utf-8")
    response.status = 201
    response.body = "ok"
    response.content_type = "text/plan"
    return
   end

  response.status = 404
  response.body = "not found"
  response.content_type = "text/plan"
end