class SentinelApi::Client

Public Class Methods

send_to_server(record) click to toggle source
# File lib/sentinel_api/client.rb, line 6
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 Class Methods

configuration() click to toggle source
# File lib/sentinel_api/client.rb, line 24
def configuration
  SentinelApi.configuration
end
prepare_request(record) click to toggle source
# File lib/sentinel_api/client.rb, line 17
def prepare_request(record)
  {
      headers: { 'Content-Type' => 'application/json' },
      body: { request_params: record }.to_json
  }
end