Class: Oohlalog::Counter

Inherits:
Object
  • Object
show all
Defined in:
lib/oohlalog/counter.rb

Instance Method Summary collapse

Instance Method Details

#increment(code, counter = 1) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/oohlalog/counter.rb', line 8

def increment(code,counter=1)
  Thread.new do
    begin
      request = Net::HTTP::Post.new("/api/counter/increment?apiKey=#{Oohlalog.api_key}&incr=#{counter}",{'Content-Type' =>'application/json'})

      http_net = Net::HTTP.new(Oohlalog.host, Oohlalog.port)
      http_net.read_timeout = 5
      http_net.start {|http| http.request(request) }
    rescue
      # puts "Oohlalog Exception**:"
    end
  end
end

#initialzieObject



5
6
# File 'lib/oohlalog/counter.rb', line 5

def initialzie
end