Sha256: e01758644fd46b7cf64de7747d6fd53b0350037a908349369250fdf80f11a6b0
Contents?: true
Size: 777 Bytes
Versions: 1
Compression:
Stored size: 777 Bytes
Contents
require 'faraday' module Staccato module Rack # Proxy Class to do page views class FaradayHttpAdaper def initialize(logger = nil) @logger = logger @conn = Faraday.new(url: 'https://ssl.google-analytics.com') do |faraday| faraday.request :url_encoded # form-encode POST params faraday.response :logger, @logger if @logger faraday.adapter Faraday.default_adapter # make requests with Net::HTTP end end def post(data) Thread.new(data) do |body_data| @conn.post do |req| req.url '/collect' req.options.timeout = 1 # open/read timeout in seconds req.body = body_data end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
staccato-rack-0.4.0 | lib/staccato/rack/faraday_http_adapter.rb |