class Wildsight::Transport::NetHttpTransport

Public Class Methods

new(agent, config) click to toggle source
# File lib/wildsight/transport/net_http.rb, line 8
def initialize(agent, config)
  @agent = agent
  @config = config
  @uri = URI(File.join(@config['transport']['url'], 'ingest', @config['transport']['key']))
end

Public Instance Methods

send(payload) click to toggle source
# File lib/wildsight/transport/net_http.rb, line 14
def send(payload)
  begin
    @agent.logger.log(:debug) { Net::HTTP.post_form(@uri, payload: MultiJson.dump(payload)).inspect }
  rescue Exception => e
    @agent.logger.log(:error) { e }
  end
end