class Sematext::Metrics::SyncSender
Public Class Methods
new(token, base_uri, path)
click to toggle source
# File lib/sematext/metrics/sync_sender.rb, line 22 def initialize(token, base_uri, path) @token = token self.class.default_options[:base_uri] = base_uri || Settings::RECEIVER_URI @path = path || Settings::RECEIVER_PATH end
Public Instance Methods
send(data)
click to toggle source
# File lib/sematext/metrics/sync_sender.rb, line 28 def send data post_options = { :query => {:token => @token}, :headers => { 'Content-Type' => 'text/plain', 'User-Agent' => Settings::USER_AGENT }, :body => data } response = self.class.post(@path, post_options) if response.code == 201 {:status => :succeed} else {:status => :failed, :response => response.parsed_response} end end