Class: Raven::Transports::HTTP

Inherits:
Transport show all
Defined in:
lib/raven/transports/http.rb

Instance Attribute Summary

Attributes inherited from Transport

#configuration

Instance Method Summary collapse

Methods inherited from Transport

#initialize

Constructor Details

This class inherits a constructor from Raven::Transports::Transport

Instance Method Details

#send(auth_header, data, options = {}) ⇒ Object



22
23
24
25
26
# File 'lib/raven/transports/http.rb', line 22

def send(auth_header, data, options = {})
  Raven.logger.warn "DEPRECATION WARNING: Calling #send on a Transport will be \
    removed in Raven-Ruby 0.14! Use #send_event instead!"
  send_event(auth_header, data, options)
end

#send_event(auth_header, data, options = {}) ⇒ Object



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

def send_event(auth_header, data, options = {})
  project_id = self.configuration[:project_id]
  path = self.configuration[:path] + "/"

  response = conn.post "#{path}api/#{project_id}/store/" do |req|
    req.headers['Content-Type'] = options[:content_type]
    req.headers['X-Sentry-Auth'] = auth_header
    req.body = data
  end
  Raven.logger.warn "Error from Sentry server (#{response.status}): #{response.body}" unless response.status == 200
  response
end