Module: PacTrac::Http

Defined in:
lib/pactrac/http.rb,
lib/pactrac/http/cookie.rb,
lib/pactrac/http/session.rb

Defined Under Namespace

Modules: Cookie, Session

Class Method Summary collapse

Class Method Details

.request(req, session) ⇒ Object



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

def request(req, session)
  raw = nil
  begin
    Timeout::timeout(10) do
      raw = session.session.request(req)
    end
  rescue Timeout::Error => e
    return Err.new(false, 'tracking request took too long to respond')
  rescue Net::HTTPError => e
    return Err.new(false, 'error making tracking request')
  end
  return Err.new(true), raw
end