class Wildsight::Transport::FaradayTransport
Public Class Methods
new(agent, config)
click to toggle source
# File lib/wildsight/transport/faraday.rb, line 6 def initialize(agent, config) @agent = agent @config = config @connection = Faraday.new(:url => @config['transport']['url']) do |faraday| faraday.request(:multipart) faraday.request(:url_encoded) faraday.adapter(Faraday.default_adapter) end @uri = File.join('ingest', @config['transport']['key']) end
Public Instance Methods
send(payload)
click to toggle source
# File lib/wildsight/transport/faraday.rb, line 17 def send(payload) begin @agent.logger.log(:debug) { @connection.post(@uri, payload: MultiJson.dump(payload)).inspect } rescue Exception => e @agent.logger.log(:error) { e } end end