lib/eotb.rb in eotb-0.5.14 vs lib/eotb.rb in eotb-0.5.15
- old
+ new
@@ -16,10 +16,12 @@
@@api_key = params[0] if params.size > 0
@@reset = 100
if params.size == 1 # DEPRECATED - remove on Eotb 0.5.17
puts 'DEPRECATION WARNING'
puts 'Eotb.configure(api_key) -- method will be removed in eotb 0.5.17'
+ @@uri = URI.parse('http://' + @@host + ':' + @@port + '/events/' + @@api_key)
+ @@post = Net::HTTP::Post.new(@@uri.path)
elsif params.size == 4 # DEPRECATED - remove on Eotb 0.5.17
puts 'DEPRECATION WARNING'
puts 'Eotb.configure(api_key, events, host, port) -- method will be removed in eotb 0.5.17'
@@host = params[2]
@@port = params[3]
@@ -84,9 +86,10 @@
end
def self.send
@@post.set_form_data(@@events)
@@counter = 1
+ @@events = {}
begin
Timeout::timeout(2) {
Net::HTTP.new(@@uri.host, @@uri.port).start.request(@@post)
}
rescue => e