Module: Bullhorn::Sender

Extended by:
Sender
Included in:
Bullhorn, Sender
Defined in:
lib/bullhorn/sender.rb

Instance Method Summary collapse

Instance Method Details

#notify(exception, env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/bullhorn/sender.rb', line 9

def notify(exception, env)
  Net::HTTP.post_form(URI(url), {
    :api_key      => api_key,
    :message      => exception.message,
    :backtrace    => serialize(exception.backtrace),
    :env          => serialize(whitelist(env)),
    :request_body => serialize(whitelist(request_body(env))),
    :sha1         => sha1(exception)
  })
end

#serialize(str) ⇒ Object



5
6
7
# File 'lib/bullhorn/sender.rb', line 5

def serialize(str)
  CGI.escape(Base64.encode64(str.to_json).strip)
end