require 'httparty' module SentinelApi class Client class << self def send_to_server(record) response = ::HTTParty.public_send(configuration.method, configuration.uri, prepare_request(record)) unless response.code == 200 SentinelApi.default_logger.warn("We sent logs(#{record}) to API Server and got #{response.code} instead of status") end rescue => e SentinelApi.default_logger.warn("Troubles with ErrorReporter API call\n #{e.message}\n #{e.backtrace}") end private def prepare_request(record) { headers: { 'Content-Type' => 'application/json' }, body: { request_params: record }.to_json } end def configuration SentinelApi.configuration end end end end